Esempio n. 1
0
    def test_patient_screening_history(self):
        """Test that the patient referral/screening history page works as expected."""
        add_service_data.main(self.app)
        user = get_user()
        user.service = Service.query.filter(Service.name == 'Daily Planet').first()
        self.login()
        patient = get_patient()

        # Make sure the page loads as expected
        response = self.client.get('/patient_screening_history/{}'.format(patient.id))
        self.assert200(response)
        self.assert_template_used('patient_screening_history.html')

        # Make sure you can save a new screening result
        response = self.client.post(
            '/patient_screening_history/{}'.format(patient.id),
            data=dict(
                eligible_yn='Y',
                sliding_scale_id=user.service.sliding_scales[0].id,
                notes='Test'
            ),
            follow_redirects=True
        )
        self.assert200(response)
        # User should stay on the same page after saving
        self.assert_template_used('patient_screening_history.html')
        screening_result = Patient.query.first().screening_results[0]
        self.assertEquals(screening_result.service_id, user.service_id)
        self.assertEquals(screening_result.eligible_yn, 'Y')
        self.assertEquals(screening_result.sliding_scale_id, user.service.sliding_scales[0].id)
        self.assertEquals(screening_result.notes, 'Test')
Esempio n. 2
0
    def test_patient_overview(self):
        """Test that the patient overview and screening result page works as expected."""
        add_service_data.main(self.app)
        user = get_user()
        user.service = Service.query.filter(
            Service.name == 'Daily Planet').first()
        self.login()
        patient = get_patient(user)

        # Make sure the page loads as expected
        response = self.client.get('/patient_overview/{}'.format(patient.id))
        self.assert200(response)
        self.assert_template_used('patient_overview.html')

        # Make sure you can save a new screening result
        response = self.client.post(
            '/patient_overview/{}'.format(patient.id),
            data=dict(eligible_yn='Y',
                      sliding_scale_id=user.service.sliding_scales[0].id,
                      notes='Test'),
            follow_redirects=True)

        self.assert200(response)
        # User should stay on the same page after saving
        self.assert_template_used('patient_overview.html')
        screening_result = Patient.query.first().screening_results[0]
        self.assertEquals(screening_result.service_id, user.service_id)
        self.assertEquals(screening_result.eligible_yn, 'Y')
        self.assertEquals(screening_result.sliding_scale_id,
                          user.service.sliding_scales[0].id)
        self.assertEquals(screening_result.notes, 'Test')
Esempio n. 3
0
 def test_login_logout(self):
     """Test logging in and out."""
     app_user = get_user()
     self.login('*****@*****.**', 'password')
     self.assert_template_used('index.html')
     self.logout()
     self.assertEquals(app_user.authenticated, False)
     self.login('*****@*****.**', 'badpassword')
     self.assert_template_used('security/login_user.html')
     self.assertEquals(app_user.authenticated, False)
Esempio n. 4
0
 def test_login_logout(self):
     """Test logging in and out."""
     app_user = get_user()
     self.login('*****@*****.**', 'password')
     self.assert_template_used('index.html')
     self.logout()
     self.assertEquals(app_user.authenticated, False)
     self.login('*****@*****.**', 'badpassword')
     self.assert_template_used('security/login_user.html')
     self.assertEquals(app_user.authenticated, False)
 def test_delete_patient(self):
     """Test that hard-deleting a patient works as expected."""
     user = get_user()
     self.login()
     patient = get_patient(user)
     response = self.client.get('/delete/{}'.format(patient.id), follow_redirects=True)
     self.assert200(response)
     # Check that patient was deleted
     self.assertTrue(Patient.query.get(patient.id).deleted)
     # Check that user is redirected to index page
     self.assert_template_used('index.html')
    def test_patient_screening_history(self):
        """Test that the patient referral/screening history page works as expected."""
        add_service_data.main(self.app)
        user = get_user()
        user.service = Service.query.filter(Service.name == 'Daily Planet').first()
        self.login()
        patient = get_patient()

        # Make sure the page loads as expected
        response = self.client.get('/patient_screening_history/{}'.format(patient.id))
        self.assert200(response)
        self.assert_template_used('patient_screening_history.html')
Esempio n. 7
0
 def test_delete_patient(self):
     """Test that hard-deleting a patient works as expected."""
     user = get_user()
     self.login()
     patient = get_patient(user)
     response = self.client.get('/delete/{}'.format(patient.id),
                                follow_redirects=True)
     self.assert200(response)
     # Check that patient was deleted
     self.assertTrue(Patient.query.get(patient.id).deleted)
     # Check that user is redirected to index page
     self.assert_template_used('index.html')
Esempio n. 8
0
    def test_patient_screening_history(self):
        """Test that the patient referral/screening history page works as expected."""
        add_service_data.main(self.app)
        user = get_user()
        user.service = Service.query.filter(
            Service.name == 'Daily Planet').first()
        self.login()
        patient = get_patient()

        # Make sure the page loads as expected
        response = self.client.get('/patient_screening_history/{}'.format(
            patient.id))
        self.assert200(response)
        self.assert_template_used('patient_screening_history.html')
Esempio n. 9
0
 def test_user(self):
     """Test that the user profile page works as expected."""
     user = get_user()
     response = self.client.get('/user/{}'.format(user.id))
     self.assert200(response)
     self.assert_template_used('user_profile.html')
Esempio n. 10
0
 def setUp(self):
     super(TestScreener, self).setUp()
     self.test_user = get_user()
Esempio n. 11
0
 def test_user(self):
     """Test that the user profile page works as expected."""
     user = get_user()
     response = self.client.get('/user/{}'.format(user.id))
     self.assert200(response)
     self.assert_template_used('user_profile.html')
Esempio n. 12
0
 def setUp(self):
     super(TestScreener, self).setUp()
     self.test_user = get_user()