@mock.patch.object(bigquery, "SignedJwtAssertionCredentials")
  @mock.patch.object(bigquery, "build")
  @mock.patch.object(bigquery.httplib2, "Http")
  def testInsertData(self, mock_http, mock_build, mock_creds):
    bq_client = bigquery.GetBigQueryClient(
        service_account=self.SERVICE_ACCOUNT, private_key=self.TEST_KEY,
        project_id=self.PROJECT_ID)

    schema_data = json.load(open(os.path.join(config_lib.CONFIG[
        "Test.data_dir"], "bigquery", "ExportedFile.schema")))
    data_fd = open(os.path.join(config_lib.CONFIG[
        "Test.data_dir"], "bigquery", "ExportedFile.json.gz"))
    now = rdfvalue.RDFDatetime().Now().AsSecondsFromEpoch()
    job_id = now % "hunts_HFFE1D044_Results_%s"
    bq_client.InsertData("ExportedFile", data_fd, schema_data, job_id)

    # We should have called insert once
    insert = mock_build.return_value.jobs.return_value.insert
    self.assertEqual(insert.call_count, 1)
    self.assertEqual(job_id, insert.call_args_list[0][1][
        "body"]["jobReference"]["jobId"])
dataset/ETHPy150Open google/grr/grr/lib/bigquery_test.py/BigQueryClientTest.testInsertData/swapped operands of `%`