Projet

Général

Profil

0001-manager-fix-redirect-url-after-announce-edit-15110.patch

Serghei Mihai, 27 février 2017 11:00

Télécharger (2,38 ko)

Voir les différences:

Subject: [PATCH] manager: fix redirect url after announce edit (#15110)

 corbo/views.py        |  2 +-
 tests/test_manager.py | 28 ++++++++++++++++++++++++++++
 2 files changed, 29 insertions(+), 1 deletion(-)
corbo/views.py
87 87
        return context
88 88

  
89 89
    def get_success_url(self):
90
        return reverse('view_category', kwargs={'pk': self.object.category.pk})
90
        return reverse('view_category', kwargs={'slug': self.object.category.slug})
91 91

  
92 92

  
93 93
edit_announce = AnnounceEditView.as_view()
tests/test_manager.py
120 120
    resp = app.get('http://localhost:80/manage/category/alerts/')
121 121
    assert 'First announce' in resp.content
122 122

  
123
def test_edit_announce(app, admin_user):
124
    app = login(app)
125
    resp = app.get('/manage/')
126
    assert 'New category' in resp.content
127
    category_page = resp.click('New category')
128
    category_form = category_page.forms[0]
129
    category_form['name'] = 'Alerts'
130
    resp = category_form.submit()
131
    assert resp.status_int == 302
132
    assert resp.location == 'http://localhost:80/manage/'
133
    resp = app.get(resp.location)
134
    resp = resp.click('Alerts')
135
    assert 'New announce' in resp.content
136
    announce_page = resp.click('New announce')
137
    announce_form = announce_page.forms[0]
138
    announce_form['title'] = 'First announce'
139
    announce_form['text'] = 'announce content'
140
    resp = announce_form.submit()
141
    assert resp.status_int == 302
142
    assert resp.location == 'http://localhost:80/manage/category/alerts/'
143
    resp = app.get(resp.location)
144
    assert 'First announce' in resp.content
145
    announce_edit_page = resp.click('First announce')
146
    edit_form = announce_edit_page.forms[0]
147
    edit_form['publication_time'] = '2017-03-03 09:00:00'
148
    resp = edit_form.submit()
149
    assert resp.status_int == 302
150
    assert resp.location == 'http://localhost:80/manage/category/alerts/'
123 151

  
124 152
def test_delete_announce(app, admin_user):
125 153
    app = login(app)
126
-