Пример #1
0
    def test_edit_issue(self):
        # goto issue show page
        env = {'REMOTE_USER': self.owner['name'].encode('ascii')}
        response = self.app.get(
            url=toolkit.url_for('issues_show',
                                dataset_id=self.dataset['id'],
                                issue_number=self.issue['number']),
            extra_environ=env,
        )
        # click the edit link
        response = response.click(linkid='issue-edit-link', extra_environ=env)
        # fill in the form
        form = response.forms['issue-edit']
        form['title'] = 'edited title'
        form['description'] = 'edited description'
        # save the form
        response = helpers.webtest_submit(form, 'save', extra_environ=env)
        response = response.follow()
        # make sure it all worked
        assert_in('edited title', response)
        assert_in('edited description', response)

        result = helpers.call_action('issue_show',
                                     dataset_id=self.dataset['id'],
                                     issue_number=self.issue['number'])
        assert_equals(u'edited title', result['title'])
        assert_equals(u'edited description', result['description'])
Пример #2
0
    def test_spatial_extra_bad_geojson(self):
        app = self._get_test_app()

        user = factories.User()
        env = {'REMOTE_USER': user['name'].encode('ascii')}
        dataset = factories.Dataset(user=user)

        offset = url_for(controller='package', action='edit', id=dataset['id'])
        res = app.get(offset, extra_environ=env)

        form = res.forms[1]
        form['extras__0__key'] = u'spatial'
        form['extras__0__value'] = u'{"Type":"Bad_GeoJSON","a":2}'

        res = helpers.webtest_submit(form, extra_environ=env, name='save')

        assert 'Error' in res, res
        assert 'Spatial' in res
        assert 'Error creating geometry' in res
Пример #3
0
    def test_spatial_extra_bad_geojson(self):
        app = self._get_test_app()

        user = factories.User()
        env = {'REMOTE_USER': user['name'].encode('ascii')}
        dataset = factories.Dataset(user=user)

        offset = url_for(controller='package', action='edit', id=dataset['id'])
        res = app.get(offset, extra_environ=env)

        form = res.forms[1]
        form['extras__0__key'] = u'spatial'
        form['extras__0__value'] = u'{"Type":"Bad_GeoJSON","a":2}'

        res = helpers.webtest_submit(form, extra_environ=env, name='save')

        assert 'Error' in res, res
        assert 'Spatial' in res
        assert 'Error creating geometry' in res
Пример #4
0
    def test_create_new_issue(self):
        env = {'REMOTE_USER': self.owner['name'].encode('ascii')}
        response = self.app.get(
            url=toolkit.url_for('issues_new', dataset_id=self.dataset['id']),
            extra_environ=env,
        )
        form = response.forms['issue-new']
        form['title'] = 'new issue'
        form['description'] = 'test_description'
        response = helpers.webtest_submit(form, 'save', extra_environ=env)

        response = response.follow()
        assert_equals(200, response.status_int)
        assert_in('Your issue has been registered, thank you for the feedback',
                  response)

        issues = helpers.call_action('issue_search',
                                     dataset_id=self.dataset['id'])
        assert_equals(1, issues['count'])
        assert_equals('new issue', issues['results'][0]['title'])
        assert_equals('test_description', issues['results'][0]['description'])
    def test_create_new_issue(self):
        env = {'REMOTE_USER': self.owner['name'].encode('ascii')}
        response = self.app.get(
            url=toolkit.url_for('issues_new', dataset_id=self.dataset['id']),
            extra_environ=env,
        )
        form = response.forms['issue-new']
        form['title'] = 'new issue'
        form['description'] = 'test_description'
        response = helpers.webtest_submit(form, 'save', extra_environ=env)

        response = response.follow()
        assert_equals(200, response.status_int)
        assert_in('Your issue has been registered, thank you for the feedback',
                  response)

        issues = helpers.call_action('issue_search',
                                     dataset_id=self.dataset['id'])
        assert_equals(1, issues['count'])
        assert_equals('new issue', issues['results'][0]['title'])
        assert_equals('test_description', issues['results'][0]['description'])
    def test_spatial_extra_bad_json(self):
        ''' '''
        app = self._get_test_app()

        user = factories.User()
        env = {u'REMOTE_USER': user[u'name'].encode(u'ascii')}
        dataset = factories.Dataset(user=user)

        offset = toolkit.url_for(controller=u'package',
                                 action=u'edit',
                                 id=dataset[u'id'])
        res = app.get(offset, extra_environ=env)

        form = res.forms[1]
        form[u'extras__0__key'] = u'spatial'
        form[u'extras__0__value'] = u'{"Type":Bad Json]'

        res = helpers.webtest_submit(form, extra_environ=env, name=u'save')

        assert u'Error' in res, res
        assert u'Spatial' in res
        assert u'Error decoding JSON object' in res