mirror of
https://github.com/simon987/nyaa.git
synced 2025-12-14 15:49:02 +00:00
Update tests, add tests structure for views
This commit is contained in:
0
tests/views/__init__.py
Normal file
0
tests/views/__init__.py
Normal file
35
tests/views/test_account.py
Normal file
35
tests/views/test_account.py
Normal file
@@ -0,0 +1,35 @@
|
||||
import unittest
|
||||
|
||||
from tests import NyaaTestCase
|
||||
|
||||
|
||||
class AccountTestCase(NyaaTestCase):
|
||||
""" Tests for nyaa.views.account """
|
||||
def test_login(self):
|
||||
rv = self.client.get('/login')
|
||||
self.assertIn(b'Username or email address', rv.data)
|
||||
|
||||
def test_logout(self):
|
||||
rv = self.client.get('/logout')
|
||||
self.assertIn(b'Redirecting...', rv.data)
|
||||
|
||||
def test_register(self):
|
||||
rv = self.client.get('/register')
|
||||
self.assertIn(b'Username', rv.data)
|
||||
self.assertIn(b'Password', rv.data)
|
||||
|
||||
@unittest.skip('Not yet implemented')
|
||||
def test_profile(self):
|
||||
pass
|
||||
|
||||
@unittest.skip('Not yet implemented')
|
||||
def test_redirect_url(self):
|
||||
pass
|
||||
|
||||
@unittest.skip('Not yet implemented')
|
||||
def test_send_verification_email(self):
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
18
tests/views/test_admin.py
Normal file
18
tests/views/test_admin.py
Normal file
@@ -0,0 +1,18 @@
|
||||
import unittest
|
||||
|
||||
from tests import NyaaTestCase
|
||||
|
||||
|
||||
class AdminTestCase(NyaaTestCase):
|
||||
""" Tests for nyaa.views.admin """
|
||||
@unittest.skip('Not yet implemented')
|
||||
def test_adminlog(self):
|
||||
pass
|
||||
|
||||
@unittest.skip('Not yet implemented')
|
||||
def test_reports(self):
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
23
tests/views/test_main.py
Normal file
23
tests/views/test_main.py
Normal 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()
|
||||
26
tests/views/test_site.py
Normal file
26
tests/views/test_site.py
Normal file
@@ -0,0 +1,26 @@
|
||||
import unittest
|
||||
|
||||
from tests import NyaaTestCase
|
||||
|
||||
|
||||
class SiteTestCase(NyaaTestCase):
|
||||
""" Tests for nyaa.views.site """
|
||||
# def test_about_url(self):
|
||||
# rv = self.client.get('/about')
|
||||
# self.assertIn(b'About', rv.data)
|
||||
|
||||
def test_rules_url(self):
|
||||
rv = self.client.get('/rules')
|
||||
self.assertIn(b'Site Rules', rv.data)
|
||||
|
||||
def test_help_url(self):
|
||||
rv = self.client.get('/help')
|
||||
self.assertIn(b'Using the Site', rv.data)
|
||||
|
||||
def test_xmlns_url(self):
|
||||
rv = self.client.get('/xmlns/nyaa')
|
||||
self.assertIn(b'Nyaa XML Namespace', rv.data)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
48
tests/views/test_torrents.py
Normal file
48
tests/views/test_torrents.py
Normal file
@@ -0,0 +1,48 @@
|
||||
import unittest
|
||||
|
||||
from tests import NyaaTestCase
|
||||
|
||||
|
||||
class TorrentsTestCase(NyaaTestCase):
|
||||
""" Tests for nyaa.views.torrents """
|
||||
|
||||
@unittest.skip('Not yet implemented')
|
||||
def test_view_url(self):
|
||||
pass
|
||||
|
||||
@unittest.skip('Not yet implemented')
|
||||
def test_edit_url(self):
|
||||
pass
|
||||
|
||||
@unittest.skip('Not yet implemented')
|
||||
def test_redirect_magnet(self):
|
||||
pass
|
||||
|
||||
@unittest.skip('Not yet implemented')
|
||||
def test_download_torrent(self):
|
||||
pass
|
||||
|
||||
@unittest.skip('Not yet implemented')
|
||||
def test_delete_comment(self):
|
||||
pass
|
||||
|
||||
@unittest.skip('Not yet implemented')
|
||||
def test_submit_report(self):
|
||||
pass
|
||||
|
||||
def test_upload_url(self):
|
||||
rv = self.client.get('/upload')
|
||||
self.assertIn(b'Upload Torrent', rv.data)
|
||||
self.assertIn(b'You are not logged in, and are uploading anonymously.', rv.data)
|
||||
|
||||
@unittest.skip('Not yet implemented')
|
||||
def test__create_upload_category_choices(self):
|
||||
pass
|
||||
|
||||
@unittest.skip('Not yet implemented')
|
||||
def test__get_cached_torrent_file(self):
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
26
tests/views/test_users.py
Normal file
26
tests/views/test_users.py
Normal file
@@ -0,0 +1,26 @@
|
||||
import unittest
|
||||
|
||||
from tests import NyaaTestCase
|
||||
|
||||
|
||||
class UsersTestCase(NyaaTestCase):
|
||||
""" Tests for nyaa.views.users """
|
||||
@unittest.skip('Not yet implemented')
|
||||
def test_view_user(self):
|
||||
pass
|
||||
|
||||
@unittest.skip('Not yet implemented')
|
||||
def test_activate_user(self):
|
||||
pass
|
||||
|
||||
@unittest.skip('Not yet implemented')
|
||||
def test__create_user_class_choices(self):
|
||||
pass
|
||||
|
||||
@unittest.skip('Not yet implemented')
|
||||
def test__get_activation_link(self):
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user