Write some tests and configs for testing
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
[run]
|
||||
omit =
|
||||
*/migrations/*
|
||||
@@ -0,0 +1,4 @@
|
||||
members/static/js/lib/*.js
|
||||
infoscreen/static/js/lib/*.js
|
||||
webapp/static/js/lib/*.js
|
||||
global_static/js/lib/*.js
|
||||
+16
-3
@@ -1,15 +1,28 @@
|
||||
from django.test import TestCase
|
||||
from django.test import TestCase, Client
|
||||
from members.models import Member
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
import time
|
||||
|
||||
class MemberRegisterTestCase(TestCase):
|
||||
|
||||
def setUp(self):
|
||||
memb = Member.objects.create(first_name="Tidus", last_name="Tester")
|
||||
test_admin = User.objects.create_superuser('test_admin', 'myemail@test.com', 'password123')
|
||||
self.c = Client()
|
||||
|
||||
def test_member_created(self):
|
||||
members = Member.objects.get(first_name="Tidus")
|
||||
self.assertTrue(members)
|
||||
exists = Member.objects.filter(first_name="Tidus").exists()
|
||||
self.assertTrue(exists)
|
||||
|
||||
def test_import_csv_single_line(self):
|
||||
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):
|
||||
data = ('Teppo, Tulppu, teppo@tulppu.fi, Ankkalinna, 0, 0\n'
|
||||
'Reiska, Remontti, remontti@reiska.fi, Värisilmä, 1, 1')
|
||||
|
||||
response = self.c.post('/members/import_csv', {'textarea': data})
|
||||
self.assertIn(response.status_code, [200, 302])
|
||||
|
||||
Reference in New Issue
Block a user