Skip to content

Commit

Permalink
tests: check for changed being set on module response
Browse files Browse the repository at this point in the history
  • Loading branch information
jharmison-redhat committed Oct 18, 2023
1 parent 81343a5 commit 8066b27
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/unit/plugins/modules/test_start_compose.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def test_start_compose_not_valid_image_type():
with pytest.raises(AnsibleFailJson) as fail_json_obj:
start_compose(module, weldr=weldr)
assert "not a valid image type" in str(fail_json_obj)
assert not fail_json_obj.value['changed']


def test_start_compose_not_supported_image_type():
Expand All @@ -49,6 +50,7 @@ def test_start_compose_not_supported_image_type():
with pytest.raises(AnsibleFailJson) as fail_json_obj:
start_compose(module, weldr=weldr)
assert "not a supported image type" in str(fail_json_obj)
assert not fail_json_obj.value['changed']


def test_start_compose_unable_to_determine_build():
Expand All @@ -58,6 +60,7 @@ def test_start_compose_unable_to_determine_build():
with pytest.raises(AnsibleFailJson) as fail_json_obj:
start_compose(module, weldr=weldr)
assert "Unable to determine state of build" in str(fail_json_obj)
assert not fail_json_obj.value['changed']


def test_start_compose_submitted_queue():
Expand All @@ -66,6 +69,7 @@ def test_start_compose_submitted_queue():
with pytest.raises(AnsibleExitJson) as exit_json_obj:
start_compose(module, weldr=weldr)
assert "Compose submitted to queue" in str(exit_json_obj)
assert exit_json_obj.value['changed']


def test_start_compose_submitted_duplicate_allowed():
Expand All @@ -82,6 +86,7 @@ def test_start_compose_submitted_duplicate_allowed():
start_compose(module, weldr=weldr)
# We expect this to work unless we set allow_duplicate to False
assert "Compose submitted to queue" in str(exit_json_obj)
assert exit_json_obj.value['changed']


def test_start_compose_submitted_duplicate():
Expand All @@ -98,3 +103,4 @@ def test_start_compose_submitted_duplicate():
with pytest.raises(AnsibleExitJson) as exit_json_obj:
start_compose(module, weldr=weldr)
assert "Not queuing a duplicate versioned" in str(exit_json_obj)
assert not exit_json_obj.value['changed']

0 comments on commit 8066b27

Please sign in to comment.