Skip to content

Commit d419bc0

Browse files
committed
test: Added tests for instances V3
1 parent 9f60a5d commit d419bc0

File tree

2 files changed

+54
-5
lines changed

2 files changed

+54
-5
lines changed

tests/integration_tests/monetize_api_test.py

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ async def test_create_new_instances(self):
145145

146146
assert res['rewardedVideo']
147147
assert (type(res['rewardedVideo']['ironSource']), len(
148-
res['rewardedVideo']['ironSource'])) == (list, 3)
148+
res['rewardedVideo']['ironSource'])) == (list, 2)
149149

150150
ironsource_instance = pydash.find(
151151
res['rewardedVideo']['ironSource'], lambda inst: inst['name'] == 'TEST')
@@ -160,6 +160,28 @@ async def test_create_new_instances(self):
160160
assert (type(res['rewardedVideo']['Vungle']), len(
161161
res['rewardedVideo']['Vungle'])) == (list, 1)
162162

163+
@pytest.mark.run(order=5)
164+
async def test_add_instances_without_appconfig(self):
165+
iron_src_api.set_credentials(API_CI_USER,
166+
API_CI_TOKEN,
167+
API_CI_SECRET)
168+
169+
assert self.__class__.TEST_APP_KEY != ''
170+
171+
vungle_instance = VungleInstance(instance_name='TEST2', ad_unit=AdUnits.RewardedVideo, app_id='',
172+
reporting_api_id='', placement_id='TEST2', status=True)
173+
174+
res = await iron_src_api.monetize_api().add_instances(self.__class__.TEST_APP_KEY,
175+
[ vungle_instance])
176+
177+
assert isinstance(res, dict)
178+
179+
assert res['rewardedVideo']
180+
assert (type(res['rewardedVideo']['Vungle']), len(
181+
res['rewardedVideo']['Vungle'])) == (list, 2)
182+
183+
184+
163185
@pytest.mark.run(order=5)
164186
async def test_update_instances(self):
165187

@@ -200,7 +222,7 @@ async def test_delete_instances(self):
200222
self.__class__.ironsource_instance_id)
201223
assert isinstance(res, dict)
202224
assert (type(res['rewardedVideo']['ironSource']), len(
203-
res['rewardedVideo']['ironSource'])) == (list, 2)
225+
res['rewardedVideo']['ironSource'])) == (list, 1)
204226

205227
@pytest.mark.run(order=8)
206228
async def test_get_mediation_group(self):

tests/unit_tests/unit_monetize_api_test.py

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,34 @@ async def test_unit_create_new_instances(self):
173173
"rewardedVideo": [{"instanceName": "TEST", "status": "active", "PlacementId": "TEST"}]}}}
174174
}
175175
mocked_req.assert_called_once_with(
176-
method='post', url="https://platform.ironsrc.com/partners/publisher/instances/v1", **options)
176+
method='post', url="https://platform.ironsrc.com/partners/publisher/instances/v3", **options)
177+
178+
@pytest.mark.asyncio
179+
async def test_unit_create_new_instance_without_appConfig(self):
180+
181+
mocked_req = self.get_mock_exec_req('{\"TEST\":\"TEST\"}')
182+
183+
vungle_instance = VungleInstance(instance_name='TEST_2', ad_unit=AdUnits.RewardedVideo, app_id='',
184+
reporting_api_id='', placement_id='TEST_2', status=True)
185+
186+
res = await ironsrc_api.monetize_api().add_instances(self.__class__.TEST_APP_KEY,
187+
[ vungle_instance])
188+
189+
options = {
190+
'headers': {
191+
'Authorization': 'Bearer TOKEN'
192+
},
193+
'json': {
194+
"appKey": "1234abc",
195+
"configurations":
196+
{
197+
"Vungle": {
198+
199+
"rewardedVideo": [{"instanceName": "TEST_2", "status": "active", "PlacementId": "TEST_2"}]}}}
200+
}
201+
mocked_req.assert_called_once_with(
202+
method='post', url="https://platform.ironsrc.com/partners/publisher/instances/v3", **options)
203+
177204

178205
@pytest.mark.asyncio
179206
async def test_unit_update_instances(self):
@@ -232,7 +259,7 @@ async def test_unit_update_instances(self):
232259
}
233260
}
234261
mocked_req.assert_called_once_with(
235-
method='put', url='https://platform.ironsrc.com/partners/publisher/instances/v1', **options)
262+
method='put', url='https://platform.ironsrc.com/partners/publisher/instances/v3', **options)
236263

237264
@pytest.mark.asyncio
238265
async def test_unit_delete_instances(self):
@@ -250,7 +277,7 @@ async def test_unit_delete_instances(self):
250277
}
251278
}
252279
mocked_req.assert_called_once_with(
253-
method='delete', url='https://platform.ironsrc.com/partners/publisher/instances/v1', **options)
280+
method='delete', url='https://platform.ironsrc.com/partners/publisher/instances/v3', **options)
254281

255282
@pytest.mark.asyncio
256283
async def test_unit_get_mediation_group(self):

0 commit comments

Comments
 (0)