Update tests, add tests structure for views

This commit is contained in:
Kfir Hadas
2017-07-15 02:49:23 +03:00
parent a758f5f078
commit d7d8d8ef14
11 changed files with 219 additions and 103 deletions

23
tests/views/test_main.py Normal file
View File

@@ -0,0 +1,23 @@
import unittest
from tests import NyaaTestCase
class MainTestCase(NyaaTestCase):
""" Tests for nyaa.views.main """
def test_index_url(self):
rv = self.client.get('/')
self.assertIn(b'Browse :: Nyaa', rv.data)
self.assertIn(b'Guest', rv.data)
def test_rss_url(self):
rv = self.client.get('/?page=rss')
self.assertIn(b'/xmlns/nyaa', rv.data)
def test_invalid_url(self):
rv = self.client.get('/notarealpage')
self.assertIn(b'404 Not Found', rv.data)
if __name__ == '__main__':
unittest.main()