|
1 | 1 | import json
|
| 2 | +import re |
| 3 | +from unittest.mock import patch |
| 4 | + |
2 | 5 | import requests_mock
|
3 | 6 |
|
4 |
| -from unittest.mock import patch |
5 |
| -from tests.example_config import BASE_DOMAIN_URL_V3_FOR_TEST |
6 | 7 | from iconsdk.builder.transaction_builder import DeployTransactionBuilder, CallTransactionBuilder
|
7 | 8 | from iconsdk.builder.transaction_builder import TransactionBuilder, MessageTransactionBuilder
|
8 | 9 | from tests.api_send.test_send_super import TestSendSuper
|
| 10 | +from tests.example_config import BASE_DOMAIN_URL_V3_FOR_TEST |
9 | 11 |
|
10 | 12 |
|
11 | 13 | @patch('iconsdk.providers.http_provider.HTTPProvider._make_id', return_value=1234)
|
12 | 14 | class TestEstimateStep(TestSendSuper):
|
| 15 | + matcher = re.compile(re.escape(f"{BASE_DOMAIN_URL_V3_FOR_TEST}/api/debug/v3/") + "?") |
13 | 16 |
|
14 | 17 | def test_estimate_step_with_send_icx_transaction(self, _make_id):
|
15 | 18 | icx_transaction = TransactionBuilder() \
|
@@ -46,7 +49,7 @@ def test_estimate_step_with_send_icx_transaction(self, _make_id):
|
46 | 49 | 'id': 1234
|
47 | 50 | }
|
48 | 51 |
|
49 |
| - m.post(f"{BASE_DOMAIN_URL_V3_FOR_TEST}/api/debug/v3/", json=response_json) |
| 52 | + m.post(self.matcher, json=response_json) |
50 | 53 | result = self.icon_service.estimate_step(icx_transaction)
|
51 | 54 | actual_request = json.loads(m._adapter.last_request.text)
|
52 | 55 |
|
@@ -88,7 +91,7 @@ def test_estimate_step_with_message_transaction(self, _make_id):
|
88 | 91 | 'id': 1234
|
89 | 92 | }
|
90 | 93 |
|
91 |
| - m.post(f"{BASE_DOMAIN_URL_V3_FOR_TEST}/api/debug/v3/", json=response_json) |
| 94 | + m.post(self.matcher, json=response_json) |
92 | 95 | result = self.icon_service.estimate_step(message_transaction)
|
93 | 96 | actual_request = json.loads(m._adapter.last_request.text)
|
94 | 97 |
|
@@ -138,7 +141,7 @@ def test_estimate_step_with_deploy_transaction(self, _make_id):
|
138 | 141 | 'id': 1234
|
139 | 142 | }
|
140 | 143 |
|
141 |
| - m.post(f"{BASE_DOMAIN_URL_V3_FOR_TEST}/api/debug/v3/", json=response_json) |
| 144 | + m.post(self.matcher, json=response_json) |
142 | 145 | result = self.icon_service.estimate_step(deploy_transaction)
|
143 | 146 | actual_request = json.loads(m._adapter.last_request.text)
|
144 | 147 |
|
@@ -186,7 +189,7 @@ def test_estimate_step_with_call_transaction(self, _make_id):
|
186 | 189 | 'result': hex(expected_step),
|
187 | 190 | 'id': 1234
|
188 | 191 | }
|
189 |
| - m.post(f"{BASE_DOMAIN_URL_V3_FOR_TEST}/api/debug/v3/", json=response_json) |
| 192 | + m.post(self.matcher, json=response_json) |
190 | 193 | result = self.icon_service.estimate_step(call_transaction)
|
191 | 194 | actual_request = json.loads(m._adapter.last_request.text)
|
192 | 195 |
|
|
0 commit comments