Пример #1
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)
Пример #2
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)