Skip to content

Commit

Permalink
tests: rename container vars for cdn_repo main() tests
Browse files Browse the repository at this point in the history
The unit tests for the main() method in the cdn_repo module used a
"module_args" fixture. This fixture only held container-specific data.

We need to make room for other fixtures and tests (to test creating RPM
repositories).

Rename the module_args pytest fixture to container_module_args.

Rename the test_simple() unit test to test_container_simple() to reflect
the fact that we're testing container-specific settings.
  • Loading branch information
ktdreyer committed May 8, 2020
1 parent d2f383a commit 9bdfc25
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions tests/test_errata_tool_cdn_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@ def __call__(self, *args, **kwargs):
return fake

@pytest.fixture
def module_args(self):
def container_module_args(self):
return {
'name': 'redhat-rhceph-rhceph-4-rhel8',
'release_type': 'Primary',
Expand All @@ -787,8 +787,8 @@ def module_args(self):
]},
}

def test_simple(self, module_args):
set_module_args(module_args)
def test_simple_container(self, container_module_args):
set_module_args(container_module_args)
with pytest.raises(AnsibleExitJson) as exit:
main()
result = exit.value.args[0]
Expand All @@ -800,20 +800,20 @@ def test_simple(self, module_args):
('Debuginfo', 'x86_64'),
('Source', 'x86_64'),
])
def test_default_arch(self, module_args, fake_ensure_cdn_repo,
def test_default_arch(self, container_module_args, fake_ensure_cdn_repo,
content_type, expected):
module_args['arch'] = None
module_args['content_type'] = content_type
set_module_args(module_args)
container_module_args['arch'] = None
container_module_args['content_type'] = content_type
set_module_args(container_module_args)
with pytest.raises(AnsibleExitJson):
main()
_, _, params = fake_ensure_cdn_repo.args
assert params['arch'] == expected

def test_docker_arch_fail(self, module_args):
module_args['content_type'] = 'Docker'
module_args['arch'] = 'x86_64'
set_module_args(module_args)
def test_docker_arch_fail(self, container_module_args):
container_module_args['content_type'] = 'Docker'
container_module_args['arch'] = 'x86_64'
set_module_args(container_module_args)
with pytest.raises(AnsibleFailJson) as exit:
main()
result = exit.value.args[0]
Expand Down

0 comments on commit 9bdfc25

Please sign in to comment.