Skip to content
This repository has been archived by the owner on Mar 28, 2019. It is now read-only.

Commit

Permalink
Merge pull request #141 from mozilla-services/328-python3-header-hand…
Browse files Browse the repository at this point in the history
…ling

Use the new cliquet utility for decode_header behavior.
  • Loading branch information
Natim committed Jul 16, 2015
2 parents 3d0b433 + 3cf66c0 commit 65f3d3f
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions kinto/tests/test_views_records.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json

from cliquet.utils import decode_header
from .support import (BaseWebTest, unittest, MINIMALIST_RECORD,
MINIMALIST_GROUP, MINIMALIST_BUCKET,
MINIMALIST_COLLECTION)
Expand Down Expand Up @@ -127,42 +128,42 @@ def test_create_a_record_update_collection_timestamp(self):
collection_resp = self.app.get(self.collection_url,
headers=self.headers)
old_timestamp = int(
json.loads(collection_resp.headers['ETag'].decode('utf-8')))
decode_header(json.loads(collection_resp.headers['ETag'])))
self.app.post_json(self.collection_url,
MINIMALIST_RECORD,
headers=self.headers,
status=201)
collection_resp = self.app.get(self.collection_url,
headers=self.headers)
new_timestamp = int(
json.loads(collection_resp.headers['ETag'].decode('utf-8')))
decode_header(json.loads(collection_resp.headers['ETag'])))
assert old_timestamp < new_timestamp

def test_update_a_record_update_collection_timestamp(self):
collection_resp = self.app.get(self.collection_url,
headers=self.headers)
old_timestamp = int(
json.loads(collection_resp.headers['ETag'].decode('utf-8')))
decode_header(json.loads(collection_resp.headers['ETag'])))
self.app.put_json(self.record_url,
MINIMALIST_RECORD,
headers=self.headers,
status=200)
collection_resp = self.app.get(self.collection_url,
headers=self.headers)
new_timestamp = int(
json.loads(collection_resp.headers['ETag'].decode('utf-8')))
decode_header(json.loads(collection_resp.headers['ETag'])))
assert old_timestamp < new_timestamp

def test_delete_a_record_update_collection_timestamp(self):
collection_resp = self.app.get(self.collection_url,
headers=self.headers)
old_timestamp = int(
json.loads(collection_resp.headers['ETag'].decode('utf-8')))
decode_header(json.loads(collection_resp.headers['ETag'])))
self.app.delete(self.record_url,
headers=self.headers,
status=200)
collection_resp = self.app.get(self.collection_url,
headers=self.headers)
new_timestamp = int(
json.loads(collection_resp.headers['ETag'].decode('utf-8')))
decode_header(json.loads(collection_resp.headers['ETag'])))
assert old_timestamp < new_timestamp

0 comments on commit 65f3d3f

Please sign in to comment.