def test_absolute_url(self):
"""
Does the server return absolute URIs?
Relies on the root returing a ``self`` object.
"""
response = requests.get(self.root_url)
resource = response.json().get('href')
assert resource is not None
href = urlparse(resource)
# Test in decreasing order of likely correctness:
# Path => Domain => Scheme
assert href.path == '/'
# Get the origin name, minus the scheme.
assert href.netloc == urlparse(self.origin).netloc
assert href.scheme == 'http'
resource = response.json().get('buckets').get('1.0')
href = urlparse(resource)
assert href.path.endswith('buckets/1.0')
评论列表
文章目录