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

django upgraded to version 2.0

parent 9c04b14f
No related branches found
No related tags found
1 merge request!263Resolve "support or sqlite"
......@@ -8,7 +8,7 @@ chardet==3.0.4
coverage==5.3
cryptography==2.3.1
cycler==0.10.0
Django==1.11.17
Django==2.0
django-cleanup==4.0.0
django-common-helpers==0.9.2
django-cron==0.5.0
......@@ -16,7 +16,7 @@ django-excel==0.0.9
django-formtools==2.2
django-otp==0.9.4
django-phonenumber-field==1.3.0
django-stronghold==0.2.9
django-stronghold==0.4.0
django-two-factor-auth==1.11
enum34==1.1.6
Faker==0.9.2
......
......@@ -168,7 +168,7 @@ class TestDailyPlanningApi(LoggedInWithWorkerTestCase):
user = User.objects.create_user(username="a", email='jacob@bla', password="b")
invalid_worker = create_worker(user)
invalid_worker.locations = [get_test_location()]
invalid_worker.locations.set([get_test_location()])
invalid_worker.save()
invalid_worker.disable()
......@@ -181,7 +181,7 @@ class TestDailyPlanningApi(LoggedInWithWorkerTestCase):
request.user = self.user
invalid_worker = create_worker()
invalid_worker.locations = [get_test_location()]
invalid_worker.locations.set([get_test_location()])
invalid_worker.save()
invalid_worker.disable()
......
......@@ -13,7 +13,7 @@ class AppointmentAddFormTests(TestCase):
self.user = create_user()
worker = Worker.get_by_user(self.user)
worker.locations = [get_test_location()]
worker.locations.set([get_test_location()])
worker.save()
self.visit = create_visit()
......
......@@ -12,7 +12,7 @@ class AppointmentEditFormTests(TestCase):
self.user = create_user()
self.worker = Worker.get_by_user(self.user)
self.worker.locations = [get_test_location()]
self.worker.locations.set([get_test_location()])
self.worker.save()
self.visit = create_visit()
......
......@@ -12,7 +12,7 @@ class AvailabilityAddFormTests(TestCase):
self.user = create_user()
worker = Worker.get_by_user(self.user)
worker.locations = [get_test_location()]
worker.locations.set([get_test_location()])
worker.save()
self.visit = create_visit()
......
......@@ -12,7 +12,7 @@ class AvailabilityEditFormTests(TestCase):
self.user = create_user()
worker = Worker.get_by_user(self.user)
worker.locations = [get_test_location()]
worker.locations .set([get_test_location()])
worker.save()
self.visit = create_visit()
......
......@@ -259,7 +259,7 @@ def create_worker(user=None, with_test_location=False):
phone_number="0123456789"
)
if with_test_location:
worker.locations = [get_test_location()]
worker.locations.set([get_test_location()])
worker.save()
WorkerStudyRole.objects.create(
worker=worker, study_id=GLOBAL_STUDY_ID, name=ROLE_CHOICES_DOCTOR)
......@@ -366,7 +366,7 @@ def create_room(owner='Test owner', city='Test city',
room = Room(owner=owner, city=city, address=address,
floor=floor, is_vehicle=is_vehicle, room_number=room_number)
room.save()
room.equipment = equipment # Cannot be made in constructor/with single save
room.equipment.set(equipment) # Cannot be made in constructor/with single save
room.save()
return room
......
......@@ -21,7 +21,7 @@ class ViewFunctionsTests(TestCase):
def test_locations_for_worker_with_location(self):
worker = create_worker()
worker.locations = [get_test_location()]
worker.locations.set([get_test_location()])
worker.save()
create_location()
......
......@@ -16,11 +16,11 @@ class TestLoginView(TestCase):
password = 'top_secret'
username = user.username
login_url = reverse(settings.LOGIN_URL)
self.assertFalse(django_auth.get_user(self.client).is_authenticated())
self.assertFalse(django_auth.get_user(self.client).is_authenticated)
form_data = {'auth-username': username, 'auth-password': password, 'login_view-current_step': 'auth'}
response = self.client.post(login_url, data=form_data, follow=True)
self.assertEqual(200, response.status_code)
self.assertTrue(django_auth.get_user(self.client).is_authenticated())
self.assertTrue(django_auth.get_user(self.client).is_authenticated)
worker = Worker.get_by_user(user)
self.assertIsNotNone(worker)
worker.last_name = 'Grouès'
......@@ -37,10 +37,10 @@ class TestLoginView(TestCase):
'login_view-current_step': 'auth'}, follow=False)
self.assertContains(response, 'Please enter a correct')
self.assertContains(response, 'and password.')
self.assertFalse(django_auth.get_user(self.client).is_authenticated())
self.assertFalse(django_auth.get_user(self.client).is_authenticated)
def test_logout(self):
self.test_login()
logout_url = reverse('logout')
self.client.get(logout_url)
self.assertFalse(django_auth.get_user(self.client).is_authenticated())
self.assertFalse(django_auth.get_user(self.client).is_authenticated)
......@@ -417,7 +417,7 @@ class NotificationViewTests(LoggedInTestCase):
def test_get_subject_with_no_visit_notifications_count_for_invalid_location(self):
worker = create_worker()
worker.locations = [create_location("l2")]
worker.locations.set([create_location("l2")])
worker.save()
original_notification = get_subject_with_no_visit_notifications_count(worker)
......@@ -429,7 +429,7 @@ class NotificationViewTests(LoggedInTestCase):
notification = get_subject_with_no_visit_notifications_count(worker)
self.assertEqual(original_notification.count, notification.count)
worker.locations = Location.objects.filter(name="l1")
worker.locations.set(Location.objects.filter(name="l1"))
worker.save()
notification = get_subject_with_no_visit_notifications_count(worker)
......
......@@ -15,7 +15,7 @@ handler400 = 'web.views.e400_bad_request'
def index(request):
if request.user.is_authenticated():
if request.user.is_authenticated:
return redirect('web.views.appointments')
return redirect(getattr(settings, "LOGIN_URL"))
......
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