Skip to content

Commit

Permalink
Unify missing addons tests
Browse files Browse the repository at this point in the history
Split the missing addons test to 2 tests - one for missing profile addon
and one for missing global addon.

Simplify the test by using minimal yaml instead of testing the valid
yaml, similar to other tests, and move the tests near other similar
tests.

Signed-off-by: Nir Soffer <nsoffer@redhat.com>
  • Loading branch information
nirs committed Jul 18, 2023
1 parent 822c410 commit 224b9a4
Showing 1 changed file with 26 additions and 5 deletions.
31 changes: 26 additions & 5 deletions test/drenv/envfile_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,6 @@ def create_addons(tmpdir):
tmpdir.mkdir(f"addon{i}")


def test_validate_missing_addons(tmpdir):
with pytest.raises(envfile.MissingAddon):
f = io.StringIO(valid_yaml)
envfile.load(f, addons_root=str(tmpdir))


def test_valid(tmpdir):
create_addons(tmpdir)
Expand Down Expand Up @@ -186,6 +181,32 @@ def test_name_prefix(tmpdir):
assert worker["addons"][0]["args"] == []


def test_missing_profile_addons(tmpdir):
s = """
name: test
profiles:
- name: dr1
workers:
- addons:
- name: addon
"""
with pytest.raises(envfile.MissingAddon):
envfile.load(io.StringIO(s), addons_root=str(tmpdir))


def test_missing_global_addons(tmpdir):
s = """
name: test
profiles:
- name: dr1
workers:
- addons:
- name: missing
"""
with pytest.raises(envfile.MissingAddon):
envfile.load(io.StringIO(s), addons_root=str(tmpdir))


def test_require_env_name():
s = """
profiles: []
Expand Down

0 comments on commit 224b9a4

Please sign in to comment.