Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hagenw committed Sep 28, 2021
1 parent 9d0901c commit 0721557
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions tests/test_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,36 @@ def test_errors(tmpdir, backend):
)


@pytest.mark.parametrize(
'backend',
[
audbackend.FileSystem(
pytest.FILE_SYSTEM_HOST,
pytest.REPOSITORY_NAME,
),
audbackend.Artifactory(
pytest.ARTIFACTORY_HOST,
pytest.REPOSITORY_NAME,
),
]
)
def test_exists(tmpdir, backend):
file = 'test.txt'
version = '1.0.0'
local_file = os.path.join(tmpdir, file)
audeer.mkdir(os.path.dirname(local_file))
with open(local_file, 'w'):
pass
remote_file = backend.join(
pytest.ID,
'test_exists',
file,
)
backend.put_file(local_file, remote_file, version)
assert backend.exists(remote_file, version)
assert not backend.exists('non-existing-file.txt', version)


@pytest.mark.parametrize(
'local_file, remote_file, version, ext',
[
Expand Down Expand Up @@ -277,6 +307,14 @@ def test_file(tmpdir, local_file, remote_file, version, ext, backend):
f'{pytest.ID}/test_glob/path/to',
['path/to/file.ext'],
),
# Test nion-existing path on server
(
[],
f'{pytest.ID}/test_non-existing-path/**/*.ext',
None,
[],
),
],
)
@pytest.mark.parametrize(
Expand Down

0 comments on commit 0721557

Please sign in to comment.