diff --git a/boards/tests/test_sync.py b/boards/tests/test_sync.py
--- a/boards/tests/test_sync.py
+++ b/boards/tests/test_sync.py
@@ -15,7 +15,7 @@ class SyncTest(TestCase):
Forms a GET request of a post and checks the response.
"""
- KeyPair.objects.generate_key(primary=True)
+ key = KeyPair.objects.generate_key(primary=True)
tag = Tag.objects.create(name='tag1')
post = Post.objects.create_post(title='test_title', text='test_text',
tags=[tag])
@@ -44,16 +44,19 @@ class SyncTest(TestCase):
'%s'
'' % (
post.global_id.key,
- post.id,
+ post.global_id.local_id,
post.global_id.key_type,
post.title,
post.get_raw_text(),
post.get_thread().get_tags().first().name,
post.get_pub_time_str(),
- ) in response_get(request).content.decode(),
+ ) in response,
'Wrong response generated for the GET request.')
post.delete()
+ key.delete()
+
+ KeyPair.objects.generate_key(primary=True)
SyncManager.parse_response_get(response)
self.assertEqual(1, Post.objects.count(),
@@ -70,3 +73,29 @@ class SyncTest(TestCase):
self.assertEqual(1, parsed_post.global_id.signature_set.count(),
'Signature was not saved.')
+
+ post = parsed_post
+
+ # Trying to sync the same once more
+ response = response_get(request).content.decode()
+
+ self.assertTrue(
+ 'success'
+ ''
+ ''
+ ''
+ ''
+ '%s'
+ '%s'
+ '%s'
+ '%s'
+ '' % (
+ post.global_id.key,
+ post.global_id.local_id,
+ post.global_id.key_type,
+ post.title,
+ post.get_raw_text(),
+ post.get_thread().get_tags().first().name,
+ post.get_pub_time_str(),
+ ) in response,
+ 'Wrong response generated for the GET request.')