Skip to content
Snippets Groups Projects
Commit a74ee30e authored by Piotr Gawron's avatar Piotr Gawron
Browse files

unused code removed

parent 6f026f6f
No related branches found
No related tags found
1 merge request!336Pylint checks
...@@ -6,7 +6,7 @@ from django.core.files.uploadedfile import SimpleUploadedFile ...@@ -6,7 +6,7 @@ from django.core.files.uploadedfile import SimpleUploadedFile
from django.urls import reverse from django.urls import reverse
from django.utils import timezone from django.utils import timezone
from web.forms import SubjectEditForm, StudySubjectEditForm, AppointmentEditForm, AppointmentAddForm from web.forms import SubjectEditForm, StudySubjectEditForm, AppointmentEditForm
from web.models import Appointment, StudySubject, Visit from web.models import Appointment, StudySubject, Visit
from web.tests import LoggedInTestCase from web.tests import LoggedInTestCase
from web.tests.functions import create_study_subject, create_visit, create_appointment, create_worker, \ from web.tests.functions import create_study_subject, create_visit, create_appointment, create_worker, \
...@@ -29,13 +29,12 @@ class AppointmentsViewTests(LoggedInTestCase): ...@@ -29,13 +29,12 @@ class AppointmentsViewTests(LoggedInTestCase):
#test get with visit_id #test get with visit_id
subject = create_study_subject() subject = create_study_subject()
visit = create_visit(subject) visit = create_visit(subject)
response = self.client.get(reverse('web.views.appointment_add', response = self.client.get(reverse('web.views.appointment_add',
kwargs={'visit_id': visit.id})) kwargs={'visit_id': visit.id}))
self.assertEqual(response.status_code, 200) self.assertEqual(response.status_code, 200)
def test_post_add_general_appointment(self): def test_post_add_general_appointment(self):
location = get_test_location() location = get_test_location()
form_appointment = AppointmentAddForm(user=self.user)
form_data = {} form_data = {}
form_data['datetime_when'] = datetime.datetime.today() form_data['datetime_when'] = datetime.datetime.today()
form_data['location'] = location.id form_data['location'] = location.id
...@@ -49,15 +48,14 @@ class AppointmentsViewTests(LoggedInTestCase): ...@@ -49,15 +48,14 @@ class AppointmentsViewTests(LoggedInTestCase):
visit = create_visit(subject) visit = create_visit(subject)
location = get_test_location() location = get_test_location()
form_data = {} form_data = {}
form_appointment = AppointmentAddForm(user=self.user)
form_data['datetime_when'] = datetime.datetime.today() form_data['datetime_when'] = datetime.datetime.today()
form_data['location'] = location.id form_data['location'] = location.id
form_data['comment'] = 'A comment with weird letters such as á è ü ñ ô' form_data['comment'] = 'A comment with weird letters such as á è ü ñ ô'
form_data['length'] = 10 form_data['length'] = 10
response = self.client.post(reverse('web.views.appointment_add', response = self.client.post(reverse('web.views.appointment_add',
kwargs={'visit_id': visit.id}), data=form_data) kwargs={'visit_id': visit.id}), data=form_data)
self.assertEqual(response.status_code, 302) self.assertEqual(response.status_code, 302)
def test_appointments_list_request(self): def test_appointments_list_request(self):
response = self.client.get(reverse('web.views.appointments')) response = self.client.get(reverse('web.views.appointments'))
self.assertEqual(response.status_code, 200) self.assertEqual(response.status_code, 200)
...@@ -103,7 +101,8 @@ class AppointmentsViewTests(LoggedInTestCase): ...@@ -103,7 +101,8 @@ class AppointmentsViewTests(LoggedInTestCase):
response = self.client.get( response = self.client.get(
reverse('web.views.appointment_edit', kwargs={'id': appointment.id})) reverse('web.views.appointment_edit', kwargs={'id': appointment.id}))
self.assertEqual(response.status_code, 200) self.assertEqual(response.status_code, 200)
self.assertTrue(appointment.comment.encode('utf8') in response.content, msg="Appointment data not visible in rendered page") self.assertTrue(appointment.comment.encode('utf8') in response.content,
msg="Appointment data not visible in rendered page")
self.assertTrue(appointment.visit.subject.comments.encode('utf8') in response.content, self.assertTrue(appointment.visit.subject.comments.encode('utf8') in response.content,
msg="Subject study data not visible in rendered page") msg="Subject study data not visible in rendered page")
self.assertTrue(appointment.visit.subject.subject.first_name.encode('utf8') in response.content, self.assertTrue(appointment.visit.subject.subject.first_name.encode('utf8') in response.content,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment