Skip to content

Commit abd3574

Browse files
tuan-phamwilliaminfante
authored andcommitted
fix: few more tests to improve coverage
1 parent 0ef971f commit abd3574

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/test_message_pact.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,28 @@ def test_definition_sparse(self):
7878
target._messages[0]['metaData'],
7979
{'contentType': 'application/json', 'source': 'legacy_api'})
8080

81+
def test_insert_new_message_once_required_attributes_provided(self):
82+
target = MessagePact(self.consumer, self.provider)
83+
(
84+
target
85+
.given('there is an alligator named John')
86+
.with_content({'name': 'John', 'document_name': 'sample_document.doc'})
87+
.with_metadata({'contentType': 'application/json'})
88+
)
89+
self.assertEqual(len(target._messages), 1)
90+
91+
(
92+
target.expects_to_receive('an alligator message')
93+
)
94+
self.assertEqual(len(target._messages), 1)
95+
self.assertEqual(target._messages[0]['description'], 'an alligator message')
96+
97+
(
98+
target.expects_to_receive('a new message description')
99+
)
100+
self.assertEqual(len(target._messages), 2)
101+
self.assertEqual(target._messages[0]['description'], 'a new message description')
102+
81103
def test_definition_without_given(self):
82104
target = MessagePact(self.consumer, self.provider)
83105
(

0 commit comments

Comments
 (0)