コード例 #1
0
    def test_json_string(self, rf, request_type, kwargs, id, text):
        project = factories.ProjectFactory()
        factories.URLFactory(url_project=project, attribute="surt", value="http://(com,example,www)")
        request = getattr(rf, request_type)("/", kwargs)
        response = views.browse_json(request, project.project_slug, "")

        assert json.loads(response.content) == [{"hasChildren": True, "id": id, "text": text}]
コード例 #2
0
    def test_status_and_content_type(self, rf):
        project = factories.ProjectFactory()
        request = rf.get("/")
        response = views.browse_json(request, project.project_slug, "")

        assert response.status_code == 200
        assert response["Content-Type"] == "application/json"