def test_delete_404(self, api):
     kind = str(self.factory().kind)
     url = url_for('api.organization_badge',
                   org=self.organization,
                   badge_kind=kind)
     response = api.delete(url)
     assert404(response)
Beispiel #2
0
 def test_oembed_for_unknown_dataset(self, api):
     '''It should raise a 404 on missing dataset.'''
     dataset_url = url_for('datasets.show', dataset='unknown',
                           _external=True)
     url = url_for('api.oembed', url=dataset_url)
     response = api.get(url)
     assert404(response)
Beispiel #3
0
def test_dataset_not_found(client):
    domain = faker.domain_name()
    remote_id = faker.unique_string()

    url = url_for('ods.preview', domain=domain, id=remote_id)

    assert404(client.get(url))
Beispiel #4
0
 def test_oembed_for_unknown_dataset(self, api):
     '''It should raise a 404 on missing dataset.'''
     dataset_url = url_for('datasets.show',
                           dataset='unknown',
                           _external=True)
     url = url_for('api.oembed', url=dataset_url)
     response = api.get(url)
     assert404(response)
Beispiel #5
0
    def test_renaming(self, client):
        tester = self.model.objects.create(slug='old')
        old_url = url_for('model_tester', model=tester)
        assert200(client.get(old_url))

        tester.slug = 'new'
        tester.save()
        new_url = url_for('model_tester', model=tester)
        assert200(client.get(new_url))
        assert404(client.get(old_url))
Beispiel #6
0
    def test_renaming(self, client):
        tester = self.model.objects.create(slug='old')
        old_url = url_for('model_tester', model=tester)
        assert200(client.get(old_url))

        tester.slug = 'new'
        tester.save()
        new_url = url_for('model_tester', model=tester)
        assert200(client.get(new_url))
        assert404(client.get(old_url))
Beispiel #7
0
def test_preview_disabled(client):
    domain = faker.domain_name()
    remote_id = faker.unique_string()
    _ = DatasetFactory(extras={  # noqa
        'harvest:remote_id': remote_id,
        'harvest:domain': domain
    })

    url = url_for('ods.preview', domain=domain, id=remote_id)

    assert404(client.get(url))
    def test_refuse_membership_404(self, api):
        user = api.login()
        member = Member(user=user, role='admin')
        organization = OrganizationFactory(members=[member])

        api_url = url_for('api.refuse_membership',
                          org=organization,
                          id=MembershipRequest().id)
        response = api.post(api_url)
        assert404(response)

        assert response.json['message'] == 'Unknown membership request id'
Beispiel #9
0
    def test_reuse_api_add_dataset_not_found(self, api):
        '''It should return 404 when adding an unknown dataset to a reuse'''
        user = api.login()
        reuse = ReuseFactory(owner=user)

        data = {'id': 'not-found', 'class': 'Dataset'}
        url = url_for('api.reuse_add_dataset', reuse=reuse)
        response = api.post(url, data)

        assert404(response)
        reuse.reload()
        assert len(reuse.datasets) == 0
Beispiel #10
0
    def test_redirects_destroyed_on_object_deleted(self, client):
        tester = self.model.objects.create(slug='first')
        first_url = url_for('model_tester', model=tester)

        tester.slug = 'second'
        tester.save().reload()
        second_url = url_for('model_tester', model=tester)

        tester.slug = 'last'
        tester.save().reload()
        last_url = url_for('model_tester', model=tester)

        tester.delete()
        assert404(client.get(first_url))
        assert404(client.get(second_url))
        assert404(client.get(last_url))

        assert SlugFollow.objects.count() is 0
Beispiel #11
0
    def test_redirects_destroyed_on_object_deleted(self, client):
        tester = self.model.objects.create(slug='first')
        first_url = url_for('model_tester', model=tester)

        tester.slug = 'second'
        tester.save().reload()
        second_url = url_for('model_tester', model=tester)

        tester.slug = 'last'
        tester.save().reload()
        last_url = url_for('model_tester', model=tester)

        tester.delete()
        assert404(client.get(first_url))
        assert404(client.get(second_url))
        assert404(client.get(last_url))

        assert SlugFollow.objects.count() is 0
Beispiel #12
0
 def test_redirect_datasets_not_found(self, client):
     response = client.get('/en/DataSet/wtf')
     assert404(response)
Beispiel #13
0
    def test_get_metric_not_found(self, api):
        '''It should raise a 404 if object does not exists'''
        response = api.get(url_for('api.metrics', id='fake'))

        assert404(response)
Beispiel #14
0
 def test_model_not_found(self, client):
     assert404(client.get('/model/not-found'))
Beispiel #15
0
 def test_delete_404(self, api):
     response = api.delete(
         url_for('api.reuse_badge',
                 reuse=self.reuse,
                 badge_kind=str(self.factory().kind)))
     assert404(response)
Beispiel #16
0
 def test_catalog_format_unknown(self, client):
     url = url_for('site.rdf_catalog_format', format='unknown')
     response = client.get(url)
     assert404(response)
Beispiel #17
0
 def test_redirect_datasets_not_found(self, client):
     response = client.get('/en/DataSet/wtf')
     assert404(response)
Beispiel #18
0
 def test_model_not_found(self, client):
     assert404(client.get('/model/not-found'))
Beispiel #19
0
 def test_oembed_with_an_unknown_url(self, api):
     '''It should fail at fetching an oembed with an invalid URL.'''
     url = url_for('api.oembed', url='http://local.test/somewhere')
     response = api.get(url)
     assert404(response)
Beispiel #20
0
 def test_oembed_with_an_unknown_url(self, api):
     '''It should fail at fetching an oembed with an invalid URL.'''
     url = url_for('api.oembed', url='http://local.test/somewhere')
     response = api.get(url)
     assert404(response)
Beispiel #21
0
 def test_model_not_found(self, client):
     assert404(client.get('/territory/l/c@latest'))
Beispiel #22
0
 def test_bad_uuid_is_404(self, client):
     assert404(client.get('/uuid/bad'))
Beispiel #23
0
 def test_model_not_found(self, client):
     assert404(client.get('/territory/l/c@latest'))
Beispiel #24
0
 def test_bad_uuid_is_404(self, client):
     assert404(client.get('/uuid/bad'))
Beispiel #25
0
 def test_catalog_format_unknown(self, client):
     url = url_for('site.rdf_catalog_format', format='unknown')
     response = client.get(url)
     assert404(response)