当前位置: 首页>>代码示例>>Python>>正文


Python helpers.assert200函数代码示例

本文整理汇总了Python中udata.tests.helpers.assert200函数的典型用法代码示例。如果您正苦于以下问题:Python assert200函数的具体用法?Python assert200怎么用?Python assert200使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了assert200函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_render_dataconnexions_6_with_data

 def test_render_dataconnexions_6_with_data(self, client):
     # Use tags until we are sure all reuse are correctly labeled
     for tag, label, description in DATACONNEXIONS_6_CATEGORIES:
         badge = Badge(kind=DATACONNEXIONS_6_CANDIDATE)
         VisibleReuseFactory(tags=['dataconnexions-6', tag], badges=[badge])
     response = client.get(url_for('gouvfr.dataconnexions6'))
     assert200(response)
开发者ID:etalab,项目名称:udata-gouvfr,代码行数:7,代码来源:tests.py

示例2: test_render_home_with_discourse

 def test_render_home_with_discourse(self, rmock, client):
     '''It should render the home page with the latest forum topic'''
     data = {
         'categories': [{
             'id': 1,
             'name': 'Category #1',
         }]
     }
     data_latest = {
         'users': [],
         'topic_list': {
             'topics': [
                 {
                     'last_posted_at': '2017-01-01',
                     'id': 1,
                     'title': 'Title',
                     'fancy_title': 'Fancy Title',
                     'slug': 'title',
                     'category_id': 1,
                     'posts_count': 1,
                     'reply_count': 1,
                     'like_count': 1,
                     'views': 1,
                     'created_at': '2017-01-01',
                     'posters': [],
                 }
             ],
         },
     }
     rmock.get('%s/site.json' % DISCOURSE_URL, json=data)
     rmock.get('%s/l/latest.json' % DISCOURSE_URL, json=data_latest)
     response = client.get(url_for('site.home'))
     assert200(response)
     assert 'Title' in response.data.decode('utf8')
开发者ID:etalab,项目名称:udata-gouvfr,代码行数:34,代码来源:tests.py

示例3: test_authorization_multiple_grant_token

    def test_authorization_multiple_grant_token(self, client, oauth):

        for i in range(3):
            client.login()
            response = client.post(url_for(
                'oauth.authorize',
                response_type='code',
                client_id=oauth.client_id,
            ), {
                'scope': 'default',
                'accept': '',
            })

            uri, params = response.location.split('?')
            code = parse_qs(params)['code'][0]

            client.logout()
            response = client.post(url_for('oauth.token'), {
                'grant_type': 'authorization_code',
                'code': code,
            }, headers=basic_header(oauth))

            assert200(response)
            assert response.content_type == 'application/json'
            assert 'access_token' in response.json
开发者ID:opendatateam,项目名称:udata,代码行数:25,代码来源:test_auth_api.py

示例4: test_no_auth

    def test_no_auth(self, api):
        '''Should not return a content type if there is no content on delete'''
        response = api.get(url_for('api.fake'))

        assert200(response)
        assert response.content_type == 'application/json'
        assert response.json == {'success': True}
开发者ID:opendatateam,项目名称:udata,代码行数:7,代码来源:test_auth_api.py

示例5: test_authorization_grant_token_body_credentials

    def test_authorization_grant_token_body_credentials(self, client, oauth):
        client.login()

        response = client.post(url_for(
            'oauth.authorize',
            response_type='code',
            client_id=oauth.client_id,
        ), {
            'scope': 'default',
            'accept': '',
        })

        uri, params = response.location.split('?')
        code = parse_qs(params)['code'][0]

        client.logout()
        response = client.post(url_for('oauth.token'), {
            'grant_type': 'authorization_code',
            'code': code,
            'client_id': oauth.client_id,
            'client_secret': oauth.secret,
        })

        assert200(response)
        assert response.content_type == 'application/json'
        assert 'access_token' in response.json
开发者ID:opendatateam,项目名称:udata,代码行数:26,代码来源:test_auth_api.py

示例6: test_oembed_region_territory_api_get

    def test_oembed_region_territory_api_get(self, api):
        '''It should fetch a region territory in the oembed format.'''
        paca, bdr, arles = create_geozones_fixtures()
        licence_ouverte = LicenseFactory(id='fr-lo', title='Licence Ouverte')
        LicenseFactory(id='notspecified', title='Not Specified')
        for territory_dataset_class in TERRITORY_DATASETS['region'].values():
            organization = OrganizationFactory(
                id=territory_dataset_class.organization_id)
            territory = territory_dataset_class(paca)
            reference = 'territory-{id}'.format(id=territory.slug)
            response = api.get(url_for('api.oembeds', references=reference))
            assert200(response)
            data = json.loads(response.data)[0]
            assert 'html' in data
            assert 'width' in data
            assert 'maxwidth' in data
            assert 'height' in data
            assert 'maxheight' in data
            assert data['type'] == 'rich'
            assert data['version'] == '1.0'

            html = data['html']
            assert territory.title in html
            assert cgi.escape(territory.url) in html
            assert 'alt="{name}"'.format(name=organization.name) in html
            assert md(territory.description, source_tooltip=True) in html
            assert 'Download from local.test' in html
            assert 'Add to your own website' in html
            if territory_dataset_class not in (
                    TERRITORY_DATASETS['region']['zonages_reg'], ):
                assert 'License: {0}'.format(licence_ouverte.title) in html
                assert '© {0}'.format(licence_ouverte.id) in html
                assert (
                    '<a data-tooltip="Source" href="http://local.test/datasets'
                    in html)
开发者ID:etalab,项目名称:udata-gouvfr,代码行数:35,代码来源:tests.py

示例7: test_base_rendering

 def test_base_rendering(self):
     response = internal(faker.word(), 32)
     assert200(response)
     assert response.mimetype == 'image/png'
     assert response.is_streamed
     etag, weak = response.get_etag()
     assert etag is not None
开发者ID:odtvince,项目名称:udata,代码行数:7,代码来源:test_backends.py

示例8: test_catalog_rdf_json_ld

 def test_catalog_rdf_json_ld(self, fmt, client):
     url = url_for('site.rdf_catalog_format', format=fmt)
     response = client.get(url)
     assert200(response)
     assert response.content_type == 'application/ld+json'
     context_url = url_for('site.jsonld_context', _external=True)
     assert response.json['@context'] == context_url
开发者ID:odtvince,项目名称:udata,代码行数:7,代码来源:test_site_rdf.py

示例9: test_post_api_list

    def test_post_api_list(self, api):
        '''It should fetch a post list from the API'''
        posts = PostFactory.create_batch(3)

        response = api.get(url_for('api.posts'))
        assert200(response)
        assert len(response.json['data']) == len(posts)
开发者ID:odtvince,项目名称:udata,代码行数:7,代码来源:test_api.py

示例10: test_swagger_resource_type

 def test_swagger_resource_type(self, api):
     response = api.get(url_for('api.specs'))
     assert200(response)
     swagger = json.loads(response.data)
     expected = swagger['paths']['/datasets/{dataset}/resources/']
     expected = expected['put']['responses']['200']['schema']['type']
     assert expected == 'array'
开发者ID:odtvince,项目名称:udata,代码行数:7,代码来源:test_swagger.py

示例11: test_render_dataset_page

    def test_render_dataset_page(self, client):
        '''It should render the dataset page'''
        org = OrganizationFactory()
        dataset = DatasetFactory(organization=org)
        ReuseFactory(organization=org, datasets=[dataset])

        response = client.get(url_for('datasets.show', dataset=dataset))
        assert200(response)
开发者ID:etalab,项目名称:udata-gouvfr,代码行数:8,代码来源:tests.py

示例12: test_oembed_with_port_in_https_url

    def test_oembed_with_port_in_https_url(self, api):
        '''It should works on HTTPS URLs with explicit port.'''
        dataset = DatasetFactory()
        url = dataset.external_url.replace('http://local.test/',
                                           'https://local.test:443/')
        api_url = url_for('api.oembed', url=url)

        assert200(api.get(api_url, base_url='https://local.test:443/'))
开发者ID:odtvince,项目名称:udata,代码行数:8,代码来源:test_oembed_api.py

示例13: test_client_credentials_grant_token

    def test_client_credentials_grant_token(self, client, oauth):
        response = client.post(url_for('oauth.token'), {
            'grant_type': 'client_credentials',
        }, headers=basic_header(oauth))

        assert200(response)
        assert response.content_type == 'application/json'
        assert 'access_token' in response.json
开发者ID:opendatateam,项目名称:udata,代码行数:8,代码来源:test_auth_api.py

示例14: test_render_metrics

 def test_render_metrics(self, client):
     '''It should render the dashboard page'''
     for i in range(3):
         org = OrganizationFactory()
         DatasetFactory(organization=org)
         ReuseFactory(organization=org)
     response = client.get(url_for('site.dashboard'))
     assert200(response)
开发者ID:etalab,项目名称:udata-gouvfr,代码行数:8,代码来源:tests.py

示例15: test_render_reuse_page

    def test_render_reuse_page(self, client):
        '''It should render the reuse page'''
        org = OrganizationFactory()
        dataset = DatasetFactory(organization=org)
        reuse = ReuseFactory(organization=org, datasets=[dataset])

        response = client.get(url_for('reuses.show', reuse=reuse))
        assert200(response)
开发者ID:etalab,项目名称:udata-gouvfr,代码行数:8,代码来源:tests.py


注:本文中的udata.tests.helpers.assert200函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。