Ejemplo n.º 1
0
    def test_status_and_content_type(self, rf):
        project = factories.ProjectFactory()
        request = rf.get("/")
        response = views.project_dump(request, project.project_slug)

        assert response.status_code == 200
        assert response["Content-Type"] == "application/json; charset=utf-8"
Ejemplo n.º 2
0
    def test_response_content(self, rf):
        project = factories.ProjectFactory()
        url = factories.URLFactory(url_project=project)
        request = rf.get("/")
        response = views.project_dump(request, project.project_slug)
        expected = {
            url.entity: {
                "attributes": {url.attribute: [url.value]},
                "nomination_count": 0,
                "nomination_score": 0,
                "nominators": [],
            }
        }

        assert json.loads(response.content) == expected
Ejemplo n.º 3
0
    def test_content_disposition(self, rf):
        project = factories.ProjectFactory()
        request = rf.get("/")
        response = views.project_dump(request, project.project_slug)

        assert response["Content-Disposition"] == "attachment; filename={0}_urls.json".format(project.project_slug)