Show More
@@ -111,7 +111,7 b' class SyncManager:' | |||
|
111 | 111 | tag_tags = et.SubElement(content_tag, TAG_TAGS) |
|
112 | 112 | for tag in thread.get_tags(): |
|
113 | 113 | tag_tag = et.SubElement(tag_tags, TAG_TAG) |
|
114 | tag_tag.text = tag.name | |
|
114 | tag_tag.text = tag.get_name() | |
|
115 | 115 | else: |
|
116 | 116 | tag_thread = et.SubElement(content_tag, TAG_THREAD) |
|
117 | 117 | thread_id = et.SubElement(tag_thread, TAG_ID) |
@@ -225,7 +225,7 b' class SyncManager:' | |||
|
225 | 225 | tag_tags = tag_content.find(TAG_TAGS) |
|
226 | 226 | for tag_tag in tag_tags: |
|
227 | 227 | tag, created = Tag.objects.get_or_create( |
|
228 | name=tag_tag.text) | |
|
228 | aliases__name=tag_tag.text) | |
|
229 | 229 | tags.append(tag) |
|
230 | 230 | |
|
231 | 231 | # TODO Check that the replied posts are already present |
@@ -10,7 +10,7 b' from boards.utils import datetime_to_epo' | |||
|
10 | 10 | |
|
11 | 11 | class ApiTest(TestCase): |
|
12 | 12 | def test_thread_diff(self): |
|
13 | tag = Tag.objects.create(name='test_tag') | |
|
13 | tag, created = Tag.objects.get_or_create_with_alias(name='test_tag') | |
|
14 | 14 | opening_post = Post.objects.create_post(title='title', text='text', |
|
15 | 15 | tags=[tag]) |
|
16 | 16 | |
@@ -50,7 +50,7 b' class ApiTest(TestCase):' | |||
|
50 | 50 | |
|
51 | 51 | def test_get_threads(self): |
|
52 | 52 | # Create 10 threads |
|
53 | tag = Tag.objects.create(name='test_tag') | |
|
53 | tag, created = Tag.objects.get_or_create_with_alias(name='test_tag') | |
|
54 | 54 | for i in range(5): |
|
55 | 55 | Post.objects.create_post(title='title', text='text', tags=[tag]) |
|
56 | 56 |
@@ -22,7 +22,7 b' class FormTest(TestCase):' | |||
|
22 | 22 | |
|
23 | 23 | valid_tags = 'tag1 tag_2 ΡΠ΅Π³_3' |
|
24 | 24 | invalid_tags = '$%_356 ---' |
|
25 | Tag.objects.create(name='tag1', required=True) | |
|
25 | Tag.objects.get_or_create_with_alias(name='tag1', required=True) | |
|
26 | 26 | |
|
27 | 27 | response = client.post(NEW_THREAD_PAGE, {'title': 'test title', |
|
28 | 28 | 'text': TEST_TEXT, |
@@ -18,7 +18,7 b' class PagesTest(TestCase):' | |||
|
18 | 18 | """Test receiving error 404 when opening a non-existent page""" |
|
19 | 19 | |
|
20 | 20 | tag_name = 'test_tag' |
|
21 | tag = Tag.objects.create(name=tag_name) | |
|
21 | tag, created = Tag.objects.get_or_create_with_alias(name=tag_name) | |
|
22 | 22 | client = Client() |
|
23 | 23 | |
|
24 | 24 | Post.objects.create_post('title', TEST_TEXT, tags=[tag]) |
@@ -9,7 +9,7 b' from boards.models.thread import STATUS_' | |||
|
9 | 9 | class PostTests(TestCase): |
|
10 | 10 | |
|
11 | 11 | def _create_post(self): |
|
12 | tag, created = Tag.objects.get_or_create(name='test_tag') | |
|
12 | tag, created = Tag.objects.get_or_create_with_alias(name='test_tag') | |
|
13 | 13 | return Post.objects.create_post(title='title', text='text', |
|
14 | 14 | tags=[tag]) |
|
15 | 15 | |
@@ -19,7 +19,7 b' class PostTests(TestCase):' | |||
|
19 | 19 | post = self._create_post() |
|
20 | 20 | |
|
21 | 21 | self.assertIsNotNone(post, 'No post was created.') |
|
22 | self.assertEqual('test_tag', post.get_thread().tags.all()[0].name, | |
|
22 | self.assertEqual('test_tag', post.get_thread().tags.all()[0].get_name(), | |
|
23 | 23 | 'No tags were added to the post.') |
|
24 | 24 | |
|
25 | 25 | def test_delete_post(self): |
@@ -83,7 +83,7 b' class PostTests(TestCase):' | |||
|
83 | 83 | def test_create_post_with_tag(self): |
|
84 | 84 | """Test adding tag to post""" |
|
85 | 85 | |
|
86 | tag = Tag.objects.create(name='test_tag') | |
|
86 | tag, created = Tag.objects.get_or_create_with_alias(name='test_tag') | |
|
87 | 87 | post = Post.objects.create_post(title='title', text='text', tags=[tag]) |
|
88 | 88 | |
|
89 | 89 | thread = post.get_thread() |
@@ -117,7 +117,7 b' class PostTests(TestCase):' | |||
|
117 | 117 | |
|
118 | 118 | key = KeyPair.objects.generate_key(primary=True) |
|
119 | 119 | |
|
120 | tag = Tag.objects.create(name='test_tag') | |
|
120 | tag, created = Tag.objects.get_or_create_with_alias(name='test_tag') | |
|
121 | 121 | |
|
122 | 122 | post = Post.objects.create_post(title='', text='', tags=[tag]) |
|
123 | 123 | post_local_reflink = Post.objects.create_post(title='', |
@@ -133,7 +133,7 b' class PostTests(TestCase):' | |||
|
133 | 133 | ways. |
|
134 | 134 | """ |
|
135 | 135 | |
|
136 | tag = Tag.objects.create(name='test_tag') | |
|
136 | tag, created = Tag.objects.get_or_create_with_alias(name='test_tag') | |
|
137 | 137 | opening_post = Post.objects.create_post(title='title', text='text', |
|
138 | 138 | tags=[tag]) |
|
139 | 139 | thread = opening_post.get_thread() |
@@ -15,7 +15,7 b' class SyncTest(TestCase):' | |||
|
15 | 15 | """ |
|
16 | 16 | |
|
17 | 17 | key = KeyPair.objects.generate_key(primary=True) |
|
18 | tag = Tag.objects.create(name='tag1') | |
|
18 | tag, created = Tag.objects.get_or_create_with_alias(name='tag1') | |
|
19 | 19 | post = Post.objects.create_post(title='test_title', |
|
20 | 20 | text='test_text\rline two', |
|
21 | 21 | tags=[tag]) |
@@ -49,7 +49,7 b' class SyncTest(TestCase):' | |||
|
49 | 49 | post.global_id.key_type, |
|
50 | 50 | post.title, |
|
51 | 51 | post.get_sync_text(), |
|
52 | post.get_thread().get_tags().first().name, | |
|
52 | post.get_thread().get_tags().first().get_name(), | |
|
53 | 53 | post.get_pub_time_str(), |
|
54 | 54 | post.version, |
|
55 | 55 | ) in response, |
@@ -66,7 +66,7 b' class SyncTest(TestCase):' | |||
|
66 | 66 | |
|
67 | 67 | parsed_post = Post.objects.first() |
|
68 | 68 | self.assertEqual('tag1', |
|
69 | parsed_post.get_thread().get_tags().first().name, | |
|
69 | parsed_post.get_thread().get_tags().first().get_name(), | |
|
70 | 70 | 'Invalid tag was parsed.') |
|
71 | 71 | |
|
72 | 72 | SyncManager.parse_response_get(response, None) |
@@ -98,7 +98,7 b' class SyncTest(TestCase):' | |||
|
98 | 98 | post.global_id.key_type, |
|
99 | 99 | post.title, |
|
100 | 100 | post.get_sync_text(), |
|
101 | post.get_thread().get_tags().first().name, | |
|
101 | post.get_thread().get_tags().first().get_name(), | |
|
102 | 102 | post.get_pub_time_str(), |
|
103 | 103 | post.version, |
|
104 | 104 | ) in response, |
@@ -106,7 +106,7 b' class SyncTest(TestCase):' | |||
|
106 | 106 | |
|
107 | 107 | def test_list_all(self): |
|
108 | 108 | key = KeyPair.objects.generate_key(primary=True) |
|
109 | tag = Tag.objects.create(name='tag1') | |
|
109 | tag, created = Tag.objects.get_or_create_with_alias(name='tag1') | |
|
110 | 110 | post = Post.objects.create_post(title='test_title', |
|
111 | 111 | text='test_text\rline two', |
|
112 | 112 | tags=[tag]) |
@@ -148,7 +148,7 b' class SyncTest(TestCase):' | |||
|
148 | 148 | |
|
149 | 149 | def test_list_existing_thread(self): |
|
150 | 150 | key = KeyPair.objects.generate_key(primary=True) |
|
151 | tag = Tag.objects.create(name='tag1') | |
|
151 | tag, created = Tag.objects.get_or_create_with_alias(name='tag1') | |
|
152 | 152 | post = Post.objects.create_post(title='test_title', |
|
153 | 153 | text='test_text\rline two', |
|
154 | 154 | tags=[tag]) |
@@ -186,7 +186,7 b' class SyncTest(TestCase):' | |||
|
186 | 186 | |
|
187 | 187 | def test_list_non_existing_thread(self): |
|
188 | 188 | key = KeyPair.objects.generate_key(primary=True) |
|
189 | tag = Tag.objects.create(name='tag1') | |
|
189 | tag, created = Tag.objects.get_or_create_with_alias(name='tag1') | |
|
190 | 190 | post = Post.objects.create_post(title='test_title', |
|
191 | 191 | text='test_text\rline two', |
|
192 | 192 | tags=[tag]) |
@@ -215,7 +215,7 b' class SyncTest(TestCase):' | |||
|
215 | 215 | |
|
216 | 216 | def test_list_pub_time(self): |
|
217 | 217 | key = KeyPair.objects.generate_key(primary=True) |
|
218 | tag = Tag.objects.create(name='tag1') | |
|
218 | tag, created = Tag.objects.get_or_create_with_alias(name='tag1') | |
|
219 | 219 | post = Post.objects.create_post(title='test_title', |
|
220 | 220 | text='test_text\rline two', |
|
221 | 221 | tags=[tag]) |
General Comments 0
You need to be logged in to leave comments.
Login now