def test_quick_entry_non_ascii_title_issue_153(self): Author.objects.create_superuser( 'root', '*****@*****.**', 'password') self.client.login(username='******', password='******') response = self.client.post('/quick-entry/', {'title': 'тест', 'tags': 'test-2', 'content': 'Test content', 'save_draft': ''}) self.assertEqual(response.status_code, 302) self.assertTrue(url_equal( response['Location'], '/admin/zinnia/entry/add/' '?tags=test-2&title=%D1%82%D0%B5%D1%81%D1%82' '&sites=1&content=%3Cp%3ETest+content%3C%2Fp%3E' '&authors=2&slug='))
def test_quick_entry_non_ascii_title_issue_153(self): Author.objects.create_superuser('root', '*****@*****.**', 'password') self.client.login(username='******', password='******') response = self.client.post( '/quick-entry/', { 'title': 'тест', 'tags': 'test-2', 'content': 'Test content', 'save_draft': '' }) self.assertEqual(response.status_code, 302) self.assertTrue( url_equal( response['Location'], '/admin/zinnia/entry/add/' '?tags=test-2&title=%D1%82%D0%B5%D1%81%D1%82' '&sites=1&content=%3Cp%3ETest+content%3C%2Fp%3E' '&authors=2&slug='))
def test_entry_comments(self): entry = self.create_published_entry() comments = self.create_discussions(entry) feed = EntryComments() self.assertEqual(list(feed.items(entry)), [comments[0]]) self.assertEqual( feed.item_link(comments[0]), '/comments/cr/%i/%i/#comment-%i-by-admin' % (self.entry_ct_id, entry.pk, comments[0].pk)) self.assertEqual(feed.get_title(entry), 'Comments on %s' % entry.title) self.assertEqual(feed.description(entry), 'The last comments on the entry %s' % entry.title) self.assertTrue( url_equal( feed.item_enclosure_url(comments[0]), 'http://www.gravatar.com/avatar/e64c7d89f26b' 'd1972efa854d13d7dd61?s=80&r=g')) self.assertEqual(feed.item_enclosure_length(entry), '100000') self.assertEqual(feed.item_enclosure_mime_type(entry), 'image/jpeg')
def test_entry_comments(self): entry = self.create_published_entry() comments = self.create_discussions(entry) feed = EntryComments() self.assertEqual(list(feed.items(entry)), [comments[0]]) self.assertEqual(feed.item_link(comments[0]), '/comments/cr/%i/%i/#comment-%i-by-admin' % (self.entry_ct_id, entry.pk, comments[0].pk)) self.assertEqual(feed.get_title(entry), 'Comments on %s' % entry.title) self.assertEqual( feed.description(entry), 'The last comments on the entry %s' % entry.title) self.assertTrue(url_equal( feed.item_enclosure_url(comments[0]), 'http://www.gravatar.com/avatar/e64c7d89f26b' 'd1972efa854d13d7dd61?s=80&r=g')) self.assertEqual(feed.item_enclosure_length(entry), '100000') self.assertEqual(feed.item_enclosure_mime_type(entry), 'image/jpeg')
def test_quick_entry(self): Author.objects.create_superuser( 'root', '*****@*****.**', 'password') response = self.client.get('/quick-entry/') self.assertEqual(response.status_code, 302) self.assertEqual( response['Location'], '/accounts/login/?next=/quick-entry/') self.client.login(username='******', password='******') response = self.client.get('/quick-entry/') self.assertEqual(response.status_code, 302) self.assertEqual( response['Location'], '/accounts/login/?next=/quick-entry/') self.client.logout() self.client.login(username='******', password='******') response = self.client.get('/quick-entry/') self.assertEqual(response.status_code, 302) self.assertEqual( response['Location'], '/admin/zinnia/entry/add/') response = self.client.post('/quick-entry/', {'content': 'test'}) self.assertEqual(response.status_code, 302) self.assertTrue(url_equal( response['Location'], '/admin/zinnia/entry/add/' '?tags=&title=&sites=1&content=' '%3Cp%3Etest%3C%2Fp%3E&authors=2&slug=')) response = self.client.post('/quick-entry/', {'title': 'test', 'tags': 'test', 'content': 'Test content', 'save_draft': ''}) entry = Entry.objects.get(title='test') self.assertEqual(response.status_code, 302) self.assertEqual( response['Location'], entry.get_absolute_url()) self.assertEqual(entry.status, DRAFT) self.assertEqual(entry.title, 'test') self.assertEqual(entry.tags, 'test') self.assertEqual(entry.content, '<p>Test content</p>')
def test_quick_entry(self): Author.objects.create_superuser('root', '*****@*****.**', 'password') response = self.client.get('/quick-entry/') self.assertEqual(response.status_code, 302) self.assertEqual(response['Location'], '/accounts/login/?next=/quick-entry/') self.client.login(username='******', password='******') response = self.client.get('/quick-entry/') self.assertEqual(response.status_code, 302) self.assertEqual(response['Location'], '/accounts/login/?next=/quick-entry/') self.client.logout() self.client.login(username='******', password='******') response = self.client.get('/quick-entry/') self.assertEqual(response.status_code, 302) self.assertEqual(response['Location'], '/admin/zinnia/entry/add/') response = self.client.post('/quick-entry/', {'content': 'test'}) self.assertEqual(response.status_code, 302) self.assertTrue( url_equal( response['Location'], '/admin/zinnia/entry/add/' '?tags=&title=&sites=1&content=' '%3Cp%3Etest%3C%2Fp%3E&authors=2&slug=')) response = self.client.post( '/quick-entry/', { 'title': 'test', 'tags': 'test', 'content': 'Test content', 'save_draft': '' }) entry = Entry.objects.get(title='test') self.assertEqual(response.status_code, 302) self.assertEqual(response['Location'], entry.get_absolute_url()) self.assertEqual(entry.status, DRAFT) self.assertEqual(entry.title, 'test') self.assertEqual(entry.tags, 'test') self.assertEqual(entry.content, '<p>Test content</p>')