Private
Public Access
1
0

passing tests, removing some obsolete views

This commit is contained in:
Sander Roosendaal
2019-01-16 13:37:36 +01:00
parent 195d623cfc
commit ba4d4ced8d
12 changed files with 74 additions and 256 deletions

View File

@@ -0,0 +1,57 @@
from statements import *
nu = datetime.datetime.now()
from django.http import Http404
from rowers.views import get_workout
# tests simple functions from views.py
class SimpleViewTest(TestCase):
def setUp(self):
self.u = UserFactory()
self.r = Rower.objects.create(user=self.u,
birthdate=faker.profile()['birthdate'],
gdproptin=True,
gdproptindate=timezone.now(),
rowerplan='basic')
self.c = Client()
self.user_workouts = WorkoutFactory.create_batch(5, user=self.r)
# self.factory = RequestFactory()
self.password = faker.word()
self.u.set_password(self.password)
self.u.save()
def tearDown(self):
for workout in self.user_workouts:
try:
os.remove(workout.csvfilename)
except (IOError, WindowsError):
pass
def start_protrial(self):
login = self.c.login(username=self.u.username, password=self.password)
self.assertTrue(login)
url = '/rowers/starttrial/'
response = self.c.get(url,follow=True)
self.assertRedirects(response,
expected_url='/rowers/list-workouts/',
status_code=302,target_status_code=200)
def start_plantrial(self):
login = self.c.login(username=self.u.username, password=self.password)
self.assertTrue(login)
url = '/rowers/startplantrial/'
response = self.c.get(url,follow=True)
self.assertRedirects(response,
expected_url='/rowers/list-workouts/',
status_code=302,target_status_code=200)