Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import unittest
- from base import BaseTestCase
- class Tests(BaseTestCase):
- # def test_index_page(self):
- # """TEST: render index page"""
- #
- # response = self.client.get('/', content_type='html/text')
- # self.assertEqual(response.status_code, 200)
- def test_user_registration(self):
- """TEST: user registration"""
- response = self.client.post('/account/registration/', data=dict(username="test", email="te@st.com", password="test"))
- print(response.status_code, response.data)
- self.assertEqual(response.status_code, 201)
- def test_registration_validation(self):
- """TEST: registration validation"""
- response = self.client.post('/account/registration/', data=dict(username="test", email="te@", password="test"))
- self.assertEqual(response.status_code, 404)
- def test_user_login(self):
- """TEST: user login"""
- response = self.client.post('/account/login/', data=dict(username="admin", password="admin"))
- self.assertEqual(response.status_code, 200)
- def test_login_undefined_user(self):
- response = self.client.post('/account/login/', data=dict(username="test", password="test"))
- self.assertEqual(response.status_code, 404)
- def test_login_wrong_password(self):
- response = self.client.post('/account/login/', data=dict(username="admin", password="test"))
- self.assertEqual(response.status_code, 404)
- if __name__ == '__main__':
- unittest.main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement