112 |
112 |
resp.forms[0]['description'] = 'simple test'
|
113 |
113 |
resp.forms[0]['service_url'] = 'https://example.net/'
|
114 |
114 |
resp = resp.forms[0].submit()
|
115 |
115 |
assert resp.status_int == 302
|
116 |
116 |
assert resp.location.endswith('/photon/test-connector/')
|
117 |
117 |
resp = resp.follow()
|
118 |
118 |
assert 'Connector updated' in resp.text
|
119 |
119 |
|
|
120 |
resp = app.get('/manage/photon/test-connector/edit', status=200)
|
|
121 |
open('/var/www/html/index.html', 'w').write(resp.text)
|
|
122 |
resp.forms[0]['slug'] = 'test'
|
|
123 |
resp = resp.forms[0].submit()
|
|
124 |
assert resp.status_int == 302
|
|
125 |
assert resp.location.endswith('/photon/test/')
|
|
126 |
|
|
127 |
|
|
128 |
def test_edit_connector_unique_slug(app, admin_user):
|
|
129 |
Photon.objects.create(
|
|
130 |
slug='test-connector',
|
|
131 |
title='Test Connector',
|
|
132 |
description='Connector for a simple test',
|
|
133 |
service_url='https://example.org/',
|
|
134 |
)
|
|
135 |
Photon.objects.create(
|
|
136 |
slug='other-connector',
|
|
137 |
title='Other Connector',
|
|
138 |
description='Connector for another test',
|
|
139 |
service_url='https://example.org/',
|
|
140 |
)
|
|
141 |
app = login(app)
|
|
142 |
resp = app.get('/manage/photon/test-connector/edit', status=200)
|
|
143 |
assert 'Test Connector' in resp.text
|
|
144 |
assert resp.html.find('input', {'name': 'title'}).attrs['data-slug-sync'] == 'slug'
|
|
145 |
|
|
146 |
resp.forms[0]['slug'] = 'other-connector'
|
|
147 |
resp = resp.forms[0].submit()
|
|
148 |
assert resp.status_int == 200
|
|
149 |
assert 'Photon with this Identifier already exists.' in resp.text
|
|
150 |
|
120 |
151 |
|
121 |
152 |
def test_visit_connectors(app, admin_user):
|
122 |
153 |
app = login(app)
|
123 |
154 |
resp = app.get('/manage/', status=200)
|
124 |
155 |
resp = resp.click('Add Connector')
|
125 |
156 |
for link in re.findall('href="(/manage.*add)"', resp.text):
|
126 |
157 |
resp = app.get(link, status=200)
|
127 |
158 |
|
128 |
|
-
|