예제 #1
0
 def test_get_gravatar(self):
     self.assertTrue(urlEqual(
         get_gravatar('*****@*****.**'),
         'http://www.gravatar.com/avatar/86d4fd4a22de452'
         'a9228298731a0b592?s=80&r=g'))
     self.assertTrue(urlEqual(
         get_gravatar('  [email protected]  ', 15, 'x', '404'),
         'http://www.gravatar.com/avatar/86d4fd4a22de452'
         'a9228298731a0b592?s=15&r=x&d=404'))
     self.assertTrue(urlEqual(
         get_gravatar('  [email protected]  ', 15, 'x', '404', 'https'),
         'https://secure.gravatar.com/avatar/86d4fd4a22de452'
         'a9228298731a0b592?s=15&r=x&d=404'))
 def test_get_gravatar(self):
     self.assertTrue(
         urlEqual(
             get_gravatar('*****@*****.**'),
             'http://www.gravatar.com/avatar/86d4fd4a22de452'
             'a9228298731a0b592?s=80&r=g'))
     self.assertTrue(
         urlEqual(
             get_gravatar('  [email protected]  ', 15, 'x', '404'),
             'http://www.gravatar.com/avatar/86d4fd4a22de452'
             'a9228298731a0b592?s=15&r=x&d=404'))
     self.assertTrue(
         urlEqual(
             get_gravatar('  [email protected]  ', 15, 'x', '404',
                          'https'),
             'https://secure.gravatar.com/avatar/86d4fd4a22de452'
             'a9228298731a0b592?s=15&r=x&d=404'))
예제 #3
0
 def test_quick_entry(self):
     Author.objects.create_superuser('root', '*****@*****.**', 'password')
     response = self.client.get('/quick-entry/')
     self.assertEqual(response.status_code, 302)
     self.assertTrue(
         urlEqual(response['Location'],
                  'http://testserver/accounts/login/?next=/quick-entry/'))
     self.client.login(username='******', password='******')
     response = self.client.get('/quick-entry/')
     self.assertEqual(response.status_code, 302)
     self.assertTrue(
         urlEqual(response['Location'],
                  'http://testserver/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'],
                      'http://testserver/admin/zinnia/entry/add/')
     response = self.client.post('/quick-entry/', {'content': 'test'})
     self.assertEqual(response.status_code, 302)
     self.assertTrue(
         urlEqual(
             response['Location'],
             'http://testserver/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.assertTrue(
         urlEqual(response['Location'],
                  'http://testserver%s' % 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>')
예제 #4
0
 def test_quick_entry(self):
     Author.objects.create_superuser(
         'root', '*****@*****.**', 'password')
     response = self.client.get('/quick-entry/')
     self.assertEqual(response.status_code, 302)
     self.assertTrue(urlEqual(
         response['Location'],
         'http://testserver/accounts/login/?next=/quick-entry/'))
     self.client.login(username='******', password='******')
     response = self.client.get('/quick-entry/')
     self.assertEqual(response.status_code, 302)
     self.assertTrue(urlEqual(
         response['Location'],
         'http://testserver/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'],
         'http://testserver/admin/zinnia/entry/add/')
     response = self.client.post('/quick-entry/', {'content': 'test'})
     self.assertEqual(response.status_code, 302)
     self.assertTrue(urlEqual(
         response['Location'],
         'http://testserver/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.assertTrue(urlEqual(
         response['Location'],
         'http://testserver%s' % 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>')
예제 #5
0
 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(urlEqual(
         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='))
예제 #6
0
 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(urlEqual(
         response['Location'],
         'http://testserver/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='))
예제 #7
0
 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/1/#comment-1-by-admin" % self.entry_ct_id)
     self.assertEqual(feed.get_title(entry), "Comments on %s" % entry.title)
     self.assertEqual(feed.description(entry), "The latest comments for the entry %s" % entry.title)
     self.assertTrue(
         urlEqual(
             feed.item_enclosure_url(comments[0]),
             "http://www.gravatar.com/avatar/e64c7d89f26b" "d1972efa854d13d7dd61?s=80&amp;r=g",
         )
     )
     self.assertEqual(feed.item_enclosure_length(entry), "100000")
     self.assertEqual(feed.item_enclosure_mime_type(entry), "image/jpeg")
예제 #8
0
 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/1/#comment-1-by-admin' % self.entry_ct_id)
     self.assertEqual(feed.get_title(entry), 'Comments on %s' % entry.title)
     self.assertEqual(feed.description(entry),
                      'The latest comments for the entry %s' % entry.title)
     self.assertTrue(
         urlEqual(
             feed.item_enclosure_url(comments[0]),
             'http://www.gravatar.com/avatar/e64c7d89f26b'
             'd1972efa854d13d7dd61?s=80&amp;r=g'))
     self.assertEqual(feed.item_enclosure_length(entry), '100000')
     self.assertEqual(feed.item_enclosure_mime_type(entry), 'image/jpeg')
예제 #9
0
 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 latest comments for the entry %s' % entry.title)
     self.assertTrue(urlEqual(
         feed.item_enclosure_url(comments[0]),
         'http://www.gravatar.com/avatar/e64c7d89f26b'
         'd1972efa854d13d7dd61?s=80&amp;r=g'))
     self.assertEqual(feed.item_enclosure_length(entry), '100000')
     self.assertEqual(feed.item_enclosure_mime_type(entry), 'image/jpeg')