Example #1
0
def test_move(teardown):
    local_file = get_local_filename(BLOB_FILE)
    temp_file = get_temp_local_filename(BLOB_FILE)
    temp_file2 = get_temp_local_filename(BLOB_FILE)
    teardown.delete(temp_file)
    teardown.delete(temp_file2)
    storage.copy(local_file, temp_file)
    storage.move(temp_file, temp_file2)
    assert_that(storage.get(temp_file2)).is_equal_to(BLOB_DATA)
    assert_that(storage.exists(temp_file)).is_false()
Example #2
0
def test_get_blob_from_gcs():
    remote_file = get_gcs_filename(BLOB_FILE)
    assert_that(storage.get(remote_file)).is_equal_to(BLOB_DATA)
Example #3
0
def test_get_tsv_from_gcs():
    remote_file = get_gcs_filename(TSV_FILE)
    assert_that(storage.get(remote_file)).is_equal_to(TSV_DATA)
Example #4
0
def test_get_json_from_gcs():
    remote_file = get_gcs_filename(JSON_FILE)
    assert_that(storage.get(remote_file)).is_equal_to(JSON_DATA)
Example #5
0
def test_copy_remote_to_remote(teardown):
    remote_file = get_gcs_filename(BLOB_FILE)
    remote_temp_file = get_temp_gcs_filename(BLOB_FILE)
    teardown.delete(remote_temp_file)
    storage.copy(remote_file, remote_temp_file)
    assert_that(storage.get(remote_temp_file)).is_equal_to(BLOB_DATA)
Example #6
0
def test_copy_remote_to_remote_with_filetype_change(teardown):
    remote_file = get_gcs_filename(CSV_FILE)
    remote_temp_file = get_temp_gcs_filename(JSON_FILE)
    teardown.delete(remote_temp_file)
    storage.copy(remote_file, remote_temp_file)
    assert_that(storage.get(remote_temp_file)).is_equal_to(CSV_DATA)
Example #7
0
def test_save_blob_to_local(teardown):
    local_file = get_temp_local_filename(BLOB_FILE)
    teardown.delete(local_file)
    storage.save(BLOB_DATA, local_file)
    assert_that(storage.get(local_file)).is_equal_to(BLOB_DATA)
Example #8
0
def test_copy_local_to_local(teardown):
    local_file = get_local_filename(BLOB_FILE)
    temp_file = get_temp_local_filename(BLOB_FILE)
    teardown.delete(temp_file)
    storage.copy(local_file, temp_file)
    assert_that(storage.get(temp_file)).is_equal_to(BLOB_DATA)
Example #9
0
def test_save_pandas_to_csv(teardown):
    local_file = get_temp_local_filename(CSV_FILE)
    teardown.delete(local_file)
    storage.save(pd.DataFrame(CSV_DATA), local_file)
    assert_that(storage.get(local_file)).is_equal_to(CSV_DATA)
Example #10
0
def test_save_blob_to_gcs(teardown):
    remote_file = get_temp_gcs_filename(BLOB_FILE)
    teardown.delete(remote_file)
    storage.save(BLOB_DATA, remote_file)
    assert_that(storage.get(remote_file)).is_equal_to(BLOB_DATA)
Example #11
0
def test_save_raw_csv_to_local(teardown):
    local_file = get_temp_local_filename(CSV_FILE)
    teardown.delete(local_file)
    storage.save(CSV_DATA_RAW, local_file, asBlob=True)
    assert_that(storage.get(local_file)).is_equal_to(CSV_DATA)
Example #12
0
def test_get_blob_from_local():
    local_file = get_local_filename(BLOB_FILE)
    assert_that(storage.get(local_file)).is_equal_to(BLOB_DATA)
Example #13
0
def test_get_tsv_from_local():
    local_file = get_local_filename(TSV_FILE)
    assert_that(storage.get(local_file)).is_equal_to(TSV_DATA)
Example #14
0
def test_get_json_from_local_as_blob():
    local_file = get_local_filename(JSON_FILE)
    assert_that(storage.get(local_file, asBlob=True)).is_equal_to(JSON_DATA_RAW)
Example #15
0
def test_get_json_from_local():
    local_file = get_local_filename(JSON_FILE)
    assert_that(storage.get(local_file)).is_equal_to(JSON_DATA)