|
1 | 1 | from functools import partial |
2 | 2 |
|
3 | 3 | import pytest |
| 4 | +from notifications_utils.international_billing_rates import INTERNATIONAL_BILLING_RATES |
4 | 5 | from notifications_utils.recipients import ( |
5 | 6 | InvalidAddressError, |
6 | 7 | InvalidEmailError, |
@@ -138,55 +139,35 @@ def test_detect_local_phone_numbers(phone_number): |
138 | 139 | assert is_local_phone_number(phone_number) is True |
139 | 140 |
|
140 | 141 |
|
| 142 | +def _billable_units(prefix): |
| 143 | + return INTERNATIONAL_BILLING_RATES[prefix]["billable_units"] |
| 144 | + |
| 145 | + |
141 | 146 | @pytest.mark.parametrize( |
142 | 147 | "phone_number, expected_info", |
143 | 148 | [ |
144 | 149 | ( |
145 | | - "+447900900123", |
| 150 | + "+27-82-123-1234", |
146 | 151 | international_phone_info( |
147 | 152 | international=True, |
148 | | - country_prefix="44", # UK |
149 | | - billable_units=1, |
| 153 | + country_prefix="27", # South Africa |
| 154 | + billable_units=_billable_units("27"), |
150 | 155 | ), |
151 | 156 | ), |
152 | 157 | ( |
153 | | - "+20-12-1234-1234", |
154 | | - international_phone_info( |
155 | | - international=True, |
156 | | - country_prefix="20", # Egypt |
157 | | - billable_units=3, |
158 | | - ), |
159 | | - ), |
160 | | - ( |
161 | | - "+201212341234", |
162 | | - international_phone_info( |
163 | | - international=True, |
164 | | - country_prefix="20", # Egypt |
165 | | - billable_units=3, |
166 | | - ), |
167 | | - ), |
168 | | - ( |
169 | | - "+79587714230", |
| 158 | + "+2302086859", |
170 | 159 | international_phone_info( |
171 | 160 | international=True, |
172 | | - country_prefix="7", # Russia |
173 | | - billable_units=1, |
| 161 | + country_prefix="230", # Mauritius |
| 162 | + billable_units=_billable_units("230"), |
174 | 163 | ), |
175 | 164 | ), |
176 | 165 | ( |
177 | 166 | "1-202-555-0104", |
178 | 167 | international_phone_info( |
179 | 168 | international=False, |
180 | 169 | country_prefix="1", # USA |
181 | | - billable_units=1, |
182 | | - ), |
183 | | - ), |
184 | | - ( |
185 | | - "+2302086859", |
186 | | - international_phone_info( |
187 | | - international=True, |
188 | | - country_prefix="230", # Mauritius |
189 | | - billable_units=2, |
| 170 | + billable_units=_billable_units("1"), |
190 | 171 | ), |
191 | 172 | ), |
192 | 173 | ], |
|
0 commit comments