def test_should_parse_schema_from_quoted_profile(self): headers = { 'content-type': ('application/json; charset=utf-8; profile="%s"' % self.SCHEMA_URL) } url = get_profile_from_header(headers) self.assertEqual(url, self.SCHEMA_URL)
def test_should_parse_schema_from_quoted_profile(self): headers = { 'content-type': ( 'application/json; charset=utf-8; profile="%s"' % self.SCHEMA_URL) } url = get_profile_from_header(headers) self.assertEqual(url, self.SCHEMA_URL)
def resource(self, url, **kwargs): response = self.request(url, **kwargs) schema = None schema_url = get_profile_from_header(response.headers) if schema_url is not None: schema = LazySchema(href=schema_url, session=self) return Resource.from_response( response=response, session=self, schema=schema)
def resource(self, url, **kwargs): response = self.request(url, **kwargs) schema = None schema_url = get_profile_from_header(response.headers) if schema_url is not None: schema = LazySchema(href=schema_url, session=self) return Resource.from_response(response=response, session=self, schema=schema)
def test_return_none_for_missing_profile(self): headers = {'content-type': 'application/json'} url = get_profile_from_header(headers) self.assertIs(url, None)
def test_return_none_for_missing_content_type(self): headers = {} url = get_profile_from_header(headers) self.assertIs(url, None)