示例#1
0
def test_delete_file(populated_housekeeper_api: HousekeeperAPI):
    """Test to fetch a file from the database"""
    # GIVEN a housekeeper api with a file
    file_obj = populated_housekeeper_api.files().first()
    assert file_obj

    # GIVEN the id of a file that exists in HK
    file_id = file_obj.id

    # WHEN deleting the file
    populated_housekeeper_api.delete_file(file_id)

    # THEN assert a file was removed
    assert populated_housekeeper_api.get_file(file_id) is None
示例#2
0
def test_get_file(populated_housekeeper_api: HousekeeperAPI):
    """Test to fetch a file from the database"""
    # GIVEN a housekeeper api with a file
    file_obj = populated_housekeeper_api.files().first()
    assert file_obj

    # GIVEN the id of a file that exists in HK
    file_id = file_obj.id

    # WHEN fetching the file with get_file
    hk_file = populated_housekeeper_api.get_file(file_id)

    # THEN assert a file was returned
    assert hk_file is not None