97 |
97 |
|
98 |
98 |
def test_manage_views(admin_user, app, connector):
|
99 |
99 |
url = '/%s/%s/' % (connector.get_connector_slug(), connector.slug)
|
100 |
100 |
resp = app.get(url)
|
101 |
101 |
assert 'Endpoints' in resp.text
|
102 |
102 |
assert not 'accessright/add' in resp.text
|
103 |
103 |
app = login(app)
|
104 |
104 |
resp = app.get(url)
|
|
105 |
description_fields = [
|
|
106 |
x.text.split(':')[0]
|
|
107 |
for x in resp.html.find('div', {'id': 'description'}).find_all('p')]
|
|
108 |
assert 'Default country code' in description_fields
|
|
109 |
assert 'Default trunk prefix' in description_fields
|
|
110 |
assert 'Maximum message length' in description_fields
|
|
111 |
assert 'Account' not in description_fields
|
|
112 |
assert 'Username' not in description_fields
|
105 |
113 |
assert 'Endpoints' in resp.text
|
106 |
114 |
assert 'accessright/add' in resp.text
|
107 |
115 |
|
108 |
116 |
|
|
117 |
@pytest.mark.parametrize('connector', [OVHSMSGateway], indirect=True)
|
|
118 |
def test_manage_views_ovh(app, connector):
|
|
119 |
connector.default_country_code = '44'
|
|
120 |
connector.account = 'secret'
|
|
121 |
connector.application_key = 'secret'
|
|
122 |
connector.application_secret = 'secret'
|
|
123 |
connector.consumer_key = 'secret'
|
|
124 |
connector.password = 'secret'
|
|
125 |
connector.username = 'secret'
|
|
126 |
connector.save()
|
|
127 |
url = '/%s/%s/' % (connector.get_connector_slug(), connector.slug)
|
|
128 |
resp = app.get(url)
|
|
129 |
description_fields = [
|
|
130 |
x.text for x in resp.html.find('div', {'id': 'description'}).find_all('p')]
|
|
131 |
assert any(x for x in description_fields if 'Default country code' in x)
|
|
132 |
assert any(x for x in description_fields if '44' in x)
|
|
133 |
assert not any(x for x in description_fields if 'secret' in x)
|
|
134 |
|
|
135 |
|
109 |
136 |
@pytest.mark.parametrize('connector', [OVHSMSGateway], indirect=True)
|
110 |
137 |
def test_sms_max_message_length(app, connector):
|
111 |
138 |
path = '/%s/%s/send/' % (connector.get_connector_slug(), connector.slug)
|
112 |
139 |
|
113 |
140 |
message_above_limit = 'a' * (connector.max_message_length + 1)
|
114 |
141 |
payload = {
|
115 |
142 |
'message': message_above_limit,
|
116 |
143 |
'from': '+33699999999',
|
117 |
|
-
|