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"
    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
    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)