185 |
185 |
with mock.patch.object(connector, 'send_msg') as send_function:
|
186 |
186 |
send_function.return_value = {}
|
187 |
187 |
result = app.post_json(base_path, params=payload)
|
188 |
188 |
connector.jobs()
|
189 |
189 |
assert send_function.call_args[1]['text'] == 'not a spam'
|
190 |
190 |
assert send_function.call_args[1]['stop'] == ('nostop' not in path)
|
191 |
191 |
|
192 |
192 |
|
|
193 |
@pytest.mark.parametrize('connector', [OVHSMSGateway], indirect=True)
|
|
194 |
@pytest.mark.parametrize('to, destination', [
|
|
195 |
('06 12 34 56 78', '0033612345678'),
|
|
196 |
('06.12.34.56.78', '0033612345678'),
|
|
197 |
('06-12-34-56-78', '0033612345678'),
|
|
198 |
('+33/612345678', '0033612345678'),
|
|
199 |
])
|
|
200 |
def test_send_schema(app, connector, to, destination):
|
|
201 |
base_path = '/%s/%s/send/' % (connector.get_connector_slug(), connector.slug)
|
|
202 |
payload = {
|
|
203 |
'message': 'not a spam',
|
|
204 |
'from': '+33699999999',
|
|
205 |
'to': [to],
|
|
206 |
}
|
|
207 |
with mock.patch.object(connector, 'send_msg') as send_function:
|
|
208 |
app.post_json(base_path, params=payload)
|
|
209 |
connector.jobs()
|
|
210 |
assert send_function.call_args[1]['destinations'] == [destination]
|
|
211 |
|
|
212 |
|
193 |
213 |
def test_ovh_new_api(app, freezer):
|
194 |
214 |
connector = OVHSMSGateway.objects.create(
|
195 |
215 |
slug='ovh', account='sms-test42',
|
196 |
216 |
application_key='RHrTdU2oTsrVC0pu',
|
197 |
217 |
application_secret='CLjtS69tTcPgCKxedeoZlgMSoQGSiXMa',
|
198 |
218 |
consumer_key='iF0zi0MJrbjNcI3hvuvwkhNk8skrigxz'
|
199 |
219 |
)
|
200 |
220 |
api = ApiUser.objects.create(username='apiuser')
|
201 |
|
-
|