Projet

Général

Profil

0001-admin-fix-creation-of-non-first-named-data-source-90.patch

Frédéric Péters, 18 novembre 2015 13:58

Télécharger (1,85 ko)

Voir les différences:

Subject: [PATCH] admin: fix creation of non-first named data source (#9020)

 tests/test_admin_pages.py | 13 +++++++++++++
 wcs/admin/data_sources.py |  2 ++
 2 files changed, 15 insertions(+)
tests/test_admin_pages.py
2306 2306
    assert NamedDataSource.get(1).name == 'a new data source'
2307 2307
    assert NamedDataSource.get(1).description == 'description of the data source'
2308 2308

  
2309
    # add a second one
2310
    resp = app.get('/backoffice/settings/data-sources/')
2311
    resp = resp.click('New Data Source')
2312
    resp.forms[0]['name'] = 'an other data source'
2313
    resp.forms[0]['description'] = 'description of the data source'
2314
    resp.forms[0]['data_source$type'] = 'Formula (Python)'
2315
    resp = resp.forms[0].submit('data_source$apply')
2316
    resp.forms[0]['data_source$value'] = repr(
2317
            [{'id': '1', 'text': 'un'}, {'id': '2', 'text': 'deux'}])
2318
    resp = resp.forms[0].submit('submit')
2319

  
2320
    assert NamedDataSource.count() == 2
2321

  
2309 2322
def test_data_sources_edit(pub):
2310 2323
    create_superuser(pub)
2311 2324
    NamedDataSource.wipe()
wcs/admin/data_sources.py
56 56
        name = form.get_widget('name').parse()
57 57
        if self.datasource.slug:
58 58
            slug = form.get_widget('slug').parse()
59
        else:
60
            slug = None
59 61

  
60 62
        for nds in NamedDataSource.select():
61 63
            if nds.id == self.datasource.id:
62
-