Skip to content
This repository was archived by the owner on Jan 17, 2025. It is now read-only.

Commit 8fb28f8

Browse files
committed
more tests for opportunity
1 parent 8a78528 commit 8fb28f8

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

tests/test_opportunity_registry.py

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,51 @@ def test_list_opportunities_assert_ack_for_invalid_opportunity(session_post,
127127

128128
# Make sure the ack method was called for the invalid opportunity
129129
assert ack_method.call_count == 1
130+
131+
132+
@patch.object(dynata_rex.OpportunityRegistry, "ack_opportunities")
133+
@patch.object(requests.Session, "post")
134+
def test_ack_opportunity(session_post, ack_method):
135+
"""list opportunities should 'ack' an opportunity returned
136+
that it cannot convert into an Opportunity object"""
137+
138+
data = TEST_DATA['test_list_opportunities'][0]
139+
140+
session_post.return_value = ResponseMock._response_mock(
141+
200, content=json.dumps(data), content_type="application/json"
142+
)
143+
REGISTRY.ack_opportunity(data['id'])
144+
145+
assert ack_method.call_count == 1
146+
147+
148+
@patch.object(dynata_rex.OpportunityRegistry, "ack_opportunities")
149+
@patch.object(requests.Session, "post")
150+
def test_ack_opportunities(session_post, ack_method):
151+
"""list opportunities should 'ack' an opportunity returned
152+
that it cannot convert into an Opportunity object"""
153+
154+
data = TEST_DATA['test_list_opportunities']
155+
156+
session_post.return_value = ResponseMock._response_mock(
157+
200, content_type="application/json"
158+
)
159+
160+
REGISTRY.ack_opportunities(data)
161+
162+
assert ack_method.call_count == 1
163+
164+
165+
@patch.object(requests.Session, "post")
166+
def test_download_collection(session_post):
167+
"""list opportunities should 'ack' an opportunity returned
168+
that it cannot convert into an Opportunity object"""
169+
170+
data = TEST_DATA['test_list_opportunities'][0]
171+
172+
session_post.return_value = ResponseMock._response_mock(
173+
200, content=json.dumps(data), content_type="application/json"
174+
)
175+
176+
r = REGISTRY.download_collection(data['id'])
177+
assert isinstance(r, dict)

0 commit comments

Comments
 (0)