Exemplo n.º 1
0
 def test_patient_create(self):
     url = self.api_url_base + 'create'
     good_create_data = {
         'first_name': 'Chocolate',
         'last_name': 'Chip',
         'address_one': '123 Cookie Lane',
         'city': 'Cookieville',
         'state': 'TN',
         'zip_code': '37201',
         'email': '*****@*****.**',
         'practice_id': self.practice.id,
         'dentist_id': self.user.id,
     }
     response = {
         'request': {
             u'city': u'Cookieville',
             u'first_name': u'Chocolate',
             u'last_name': u'Chip',
             u'dentist_id': 2,
             u'practice_id': 1,
             u'state': u'TN',
             u'address_one': u'123 Cookie Lane',
             u'email': u'*****@*****.**',
             u'zip_code': u'37201',
             u'practice_id': self.practice.id,
             u'dentist_id': self.user.id,
         },
         'response': {
             'patient_id': 2
         }
     }
     headers = make_headers(good_create_data, self.user.email, self.user.secret)
     status_code, request = make_post_request(headers, good_create_data, url)
     assert status_code == 201
     assert response == json.loads(request)
Exemplo n.º 2
0
 def test_practitioner_good_edit(self):
     os.environ['DATABASE_URL'] = 'sqlite:////tmp/test.db'
     from cagenix import db
     self.user.activated = True
     db.session.add(self.user)
     db.session.commit()
     url = self.api_url_base + str(self.user.id)
     response = {
         'request': {
             'first_name': 'Chocolate',
             'last_name': 'Chip',
             'address_one': '123 Cookie Lane',
             'city': 'Cookieville2',
             'state': 'TN',
             'zip_code': '37201',
             'email': '*****@*****.**',
         },
         'response': {
             'practitioner_id': 2,
             'active': True
         }
     }
     headers = make_headers(self.good_edit_data, self.user.email, self.user.secret)
     status_code, request = make_put_request(headers, self.good_edit_data, url)
     assert status_code == 200
     assert response == json.loads(request)
Exemplo n.º 3
0
 def test_patient_good_edit(self):
     url = self.api_url_base + str(self.patient.id)
     good_edit_data = {
         u'active': True,
         u'first_name': u'Chocolate',
         u'last_name': u'Chip',
         u'address_one': u'123 Cookie Lane',
         u'city': u'Cookieville',
         u'state': u'TN',
         u'zip_code': u'37201',
         u'email': u'[email protected]',
         u'choice_one': '',
         u'choice_two': '',
         u'choice_three': '',
         u'practice_id': 1,
         u'dentist_id': 2,
     }
     response = {
         'request': {
             u'active': True,
             u'first_name': u'Chocolate',
             u'last_name': u'Chip',
             u'address_one': u'123 Cookie Lane',
             u'city': u'Cookieville',
             u'state': u'TN',
             u'zip_code': u'37201',
             u'email': u'[email protected]',
             u'choice_one': '',
             u'choice_two': '',
             u'choice_three': '',
             u'practice_id': 1,
             u'dentist_id': 2,
         },
         'response': {
             'patient_id': 1,
             'active': True
         }
     }
     headers = make_headers(good_edit_data, self.user.email, self.user.secret)
     status_code, request = make_put_request(headers, good_edit_data, url)
     print json.loads(request)
     assert status_code == 200
     assert response == json.loads(request)
Exemplo n.º 4
0
    def test_patient_delete(self):
        url = self.api_url_base + str(self.patient.id)
        response = {
            'request': {
                'patient_id': self.patient.id,
            },
            'response': {
                'status': 'Success',
            }
        }

        good_delete_data = {
            'patient_id': self.patient.id,
        }

        headers = make_headers(good_delete_data, self.user.email, self.user.secret)
        status_code, request = make_delete_request(headers, good_delete_data, url)
        assert status_code == 200
        assert response == json.loads(request)
Exemplo n.º 5
0
    def test_practitioner_delete(self):
        os.environ['DATABASE_URL'] = 'sqlite:////tmp/test.db'
        from cagenix import db
        self.user.activated = True
        db.session.add(self.user)
        db.session.commit()
        url = self.api_url_base + str(self.user.id)
        response = {
            'request': {
                'practitioner_id': self.user.id,
            },
            'response': {
                'status': 'Success',
            }
        }

        good_delete_data = {
            'practitioner_id': 2,
        }

        headers = make_headers(good_delete_data, self.user.email, self.user.secret)
        status_code, request = make_delete_request(headers, good_delete_data, url)
        assert status_code == 200
        assert response == json.loads(request)