Example #1
0
 def test_storage_client_creation(self, mock_client, mock_get_connetion,
                                  mock_get_creds_and_project_id,
                                  mock_client_info):
     hook = gcs.GCSHook()
     result = hook.get_conn()
     # test that Storage Client is called with required arguments
     mock_client.assert_called_once_with(client_info="CLIENT_INFO",
                                         credentials="CREDENTIALS",
                                         project="PROJECT_ID")
     self.assertEqual(mock_client.return_value, result)
Example #2
0
    def setUp(self):
        with mock.patch(BASE_STRING.format('CloudBaseHook.__init__')):
            self.gcs_hook = gcs.GCSHook(google_cloud_storage_conn_id='test')

        # generate a 384KiB test file (larger than the minimum 256KiB multipart chunk size)
        self.testfile = tempfile.NamedTemporaryFile(delete=False)
        self.testfile.write(b"x" * 393216)
        self.testfile.flush()
        self.testdata_bytes = b"x" * 393216
        self.testdata_str = "x" * 393216
Example #3
0
 def setUp(self):
     with mock.patch(GCS_STRING.format("CloudBaseHook.__init__"),
                     new=mock_base_gcp_hook_default_project_id):
         self.gcs_hook = gcs.GCSHook(google_cloud_storage_conn_id="test")
 def setUp(self):
     with mock.patch(
             GCS_STRING.format('GoogleBaseHook.__init__'),
             new=mock_base_gcp_hook_default_project_id,
     ):
         self.gcs_hook = gcs.GCSHook(gcp_conn_id='test')