Fix members pep8 and add docstrings
This commit is contained in:
+9
-3
@@ -1,28 +1,34 @@
|
||||
"""File containing Member app tests."""
|
||||
|
||||
from django.test import TestCase, Client
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
import time
|
||||
|
||||
from members.models import Member
|
||||
|
||||
|
||||
class MemberRegisterTestCase(TestCase):
|
||||
"""Tests member registration."""
|
||||
|
||||
def setUp(self):
|
||||
"""Setup testing environment by creating member and admin."""
|
||||
memb = Member.objects.create(first_name="Tidus", last_name="Tester")
|
||||
test_admin = User.objects.create_superuser('test_admin', 'myemail@test.com', 'password123')
|
||||
test_admin = User.objects.create_superuser(
|
||||
'test_admin', 'myemail@test.com', 'password123')
|
||||
self.c = Client()
|
||||
|
||||
def test_member_created(self):
|
||||
"""Test member creation."""
|
||||
exists = Member.objects.filter(first_name="Tidus").exists()
|
||||
self.assertTrue(exists)
|
||||
|
||||
def test_import_csv_single_line(self):
|
||||
"""Test csv import only with single line in csv file."""
|
||||
data = 'Teppo, Tulppu, teppo@tulppu.fi, Ankkalinna, 0, 0'
|
||||
response = self.c.post('/members/import_csv', {'textarea': data})
|
||||
self.assertIn(response.status_code, [200, 302])
|
||||
|
||||
def test_import_csv_multi_line(self):
|
||||
"""Test csv import with multilined csv."""
|
||||
data = ('Teppo, Tulppu, teppo@tulppu.fi, Ankkalinna, 0, 0\n'
|
||||
'Reiska, Remontti, remontti@reiska.fi, Värisilmä, 1, 1')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user