def test_read_all_json_files_positive(mocked_object): """Check the method read_all_json_files().""" s3DataStore = S3DataStore("bucket", "access_key", "sercet_key") s3DataStore.s3_resource = _MockedS3Resource() s3DataStore.read_all_json_files()
def test_write_json_file(): """Check the method write_json_file().""" # try for improper access_key and secret_key s3DataStore = S3DataStore("bucket", "access_key", "sercet_key") with pytest.raises(Exception): s3DataStore.write_json_file("file", {})
def test_list_files(): """Check the method list_files().""" # try for improper access_key and secret_key s3DataStore = S3DataStore("bucket", "access_key", "sercet_key") with pytest.raises(Exception): s3DataStore.list_files()
def test_get_name(): """Check the method get_name().""" s3DataStore = S3DataStore("bucket", "access_key", "sercet_key") assert s3DataStore.get_name() == "S3:bucket"
def test_read_json_file_negative(): """Check the method read_json_file().""" # try for improper access_key and secret_key s3DataStore = S3DataStore("bucket", "access_key", "sercet_key") with pytest.raises(Exception): s3DataStore.read_json_file("file")
def test_write_json_file_mocked_s3(): """Check the method write_json_file() with mocked S3 object.""" # try for improper access_key and secret_key s3DataStore = S3DataStore("bucket", "access_key", "secret_key") s3DataStore.s3_resource = MockedS3Resource() s3DataStore.write_json_file("file", {})
def test_read_json_file_positive(): """Check the method read_json_file().""" s3DataStore = S3DataStore("bucket", "access_key", "secret_key") s3DataStore.s3_resource = MockedS3Resource() s3DataStore.read_json_file("file")
def test_read_json_file_into_pandas_df(_mocked_df): """Check the method read_json_file_into_pandas_df().""" s3DataStore = S3DataStore("bucket", "access_key", "secret_key") s3DataStore.s3_resource = MockedS3Resource() s3DataStore.read_json_file_into_pandas_df("payload.json")
def test_upload_file(): """Check the method download_file().""" s3DataStore = S3DataStore("bucket", "access_key", "secret_key") s3DataStore.bucket = MockedS3Bucket("src", "target") s3DataStore.upload_file("src", "target")
def test_initial_state(): """Check the initial state of S3DataStore object.""" s3DataStore = S3DataStore("bucket", "access_key", "secret_key") assert s3DataStore