Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove py27 support #1050

Merged
merged 27 commits into from
Feb 16, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions tests/test_views_buckets.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def setUp(self):
MINIMALIST_RECORD,
headers=self.headers)
record_id = r.json['data']['id']
self.record_url = self.collection_url + '/records/%s' % record_id
self.record_url = self.collection_url + '/records/{record_id}'.format(record_id=record_id)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When there's only one you can do "/records/{}".format(record_id)

Copy link
Member Author

@Natim Natim Feb 3, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes but is it a good idea to do that?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For that particular case I guess it is (may have to judge them one by one)

# Delete the bucket.
self.app.delete(self.bucket_url, headers=self.headers)

Expand Down Expand Up @@ -230,7 +230,7 @@ def test_every_collections_are_deleted_too(self):
self.app.get(self.collection_url, headers=self.headers, status=404)

# Verify tombstones
resp = self.app.get('%s/collections?_since=0' % self.bucket_url,
resp = self.app.get('{bucket_url}/collections?_since=0'.format(bucket_url=self.bucket_url),
headers=self.headers)
self.assertEqual(len(resp.json['data']), 0)

Expand All @@ -239,7 +239,7 @@ def test_every_groups_are_deleted_too(self):
headers=self.headers)
self.app.get(self.group_url, headers=self.headers, status=404)
# Verify tombstones
resp = self.app.get('%s/groups?_since=0' % self.bucket_url,
resp = self.app.get('{bucket_url}/groups?_since=0'.format(bucket_url=self.bucket_url),
headers=self.headers)
self.assertEqual(len(resp.json['data']), 0)

Expand All @@ -251,8 +251,9 @@ def test_every_records_are_deleted_too(self):
self.app.get(self.record_url, headers=self.headers, status=404)

# Verify tombstones
resp = self.app.get('%s/records?_since=0' % self.collection_url,
headers=self.headers)
resp = self.app.get(
'{collection_url}/records?_since=0'.format(collection_url=self.collection_url),
headers=self.headers)
self.assertEqual(len(resp.json['data']), 0)

def test_can_be_created_after_deletion_with_if_none_match_star(self):
Expand Down
15 changes: 8 additions & 7 deletions tests/test_views_collections_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def test_expires_and_cache_control_headers_are_set(self):
self.assertIn('Expires', r.headers)
self.assertEqual(r.headers['Cache-Control'], 'max-age=3600')

r = self.app.get(url + '/%s' % self.record['id'])
r = self.app.get(url + '/{record_id}'.format(record_id=self.record['id']))
self.assertIn('Expires', r.headers)
self.assertEqual(r.headers['Cache-Control'], 'max-age=3600')

Expand All @@ -45,11 +45,12 @@ def setUp(self):

def create_record_in_collection(bucket_id, collection_id):
bucket = {**MINIMALIST_BUCKET, 'permissions': {'read': ['system.Everyone']}}
self.app.put_json('/buckets/%s' % bucket_id,
self.app.put_json('/buckets/{bucket_id}'.format(bucket_id=bucket_id),
bucket,
headers=self.headers)
collection_url = '/buckets/%s/collections/%s' % (bucket_id,
collection_id)
collection_url = '/buckets/{bucket_id}/collections/{collection_id}'.format(
bucket_id=bucket_id,
collection_id=collection_id)
self.app.put_json(collection_url,
MINIMALIST_COLLECTION,
headers=self.headers)
Expand All @@ -64,18 +65,18 @@ def create_record_in_collection(bucket_id, collection_id):
def assertHasCache(self, url, age):
r = self.app.get(url)
self.assertIn('Expires', r.headers)
self.assertEqual(r.headers['Cache-Control'], 'max-age=%s' % age)
self.assertEqual(r.headers['Cache-Control'], 'max-age={age}'.format(age=age))

def test_for_records_on_a_specific_bucket(self):
collection_url = '/buckets/blog/collections/cached/records'
self.assertHasCache(collection_url, 30)
record_url = collection_url + '/%s' % self.blog_record['id']
record_url = collection_url + '/{record_id}'.format(record_id=self.blog_record['id'])
self.assertHasCache(record_url, 30)

def test_for_records_on_a_specific_collection(self):
collection_url = '/buckets/browser/collections/top500/records'
self.assertHasCache(collection_url, 60)
record_url = collection_url + '/%s' % self.app_record['id']
record_url = collection_url + '/{record_id}'.format(record_id=self.app_record['id'])
self.assertHasCache(record_url, 60)


Expand Down
2 changes: 1 addition & 1 deletion tests/test_views_objects_permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def setUp(self):
{'permissions': {'read': ['system.Authenticated']}},
headers=self.alice_headers)
for parent in ('create', 'write', 'read'):
self.app.put_json('/buckets/%s/groups/child' % parent,
self.app.put_json('/buckets/{parent}/groups/child'.format(parent=parent),
MINIMALIST_GROUP,
headers=self.alice_headers)
self.bob_headers_safe_creation = dict({'If-None-Match': '*'},
Expand Down