Projet

Général

Profil

0002-tests-add-test-on-connector-edit-view-5778.patch

Nicolas Roche, 08 juin 2022 12:22

Télécharger (1,78 ko)

Voir les différences:

Subject: [PATCH 2/4] tests: add test on connector edit view (#5778)

 tests/test_manager.py | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
tests/test_manager.py
92 92
    resp2 = resp.forms[0].submit()
93 93
    assert 'There were errors processing your form.' in resp2.text
94 94
    assert 'this Identifier already exists.' in resp2.text
95 95
    resp.forms[0]['slug'] = 'foo'
96 96
    resp2 = resp.forms[0].submit()
97 97
    assert resp2.status_int == 302
98 98

  
99 99

  
100
def test_edit_connector(app, admin_user):
101
    Photon.objects.create(
102
        slug='test-connector',
103
        title='Test Connector',
104
        description='Connector for a simple test',
105
        service_url='https://example.org/',
106
    )
107
    app = login(app)
108
    resp = app.get('/manage/photon/test-connector/edit', status=200)
109
    assert 'Test Connector' in resp.text
110

  
111
    resp.forms[0]['title'] = 'Connector updated'
112
    resp.forms[0]['description'] = 'simple test'
113
    resp.forms[0]['service_url'] = 'https://example.net/'
114
    resp = resp.forms[0].submit()
115
    assert resp.status_int == 302
116
    assert resp.location.endswith('/photon/test-connector/')
117
    resp = resp.follow()
118
    assert 'Connector updated' in resp.text
119

  
120

  
100 121
def test_visit_connectors(app, admin_user):
101 122
    app = login(app)
102 123
    resp = app.get('/manage/', status=200)
103 124
    resp = resp.click('Add Connector')
104 125
    for link in re.findall('href="(/manage.*add)"', resp.text):
105 126
        resp = app.get(link, status=200)
106 127

  
107 128

  
108
-