Ejemplo n.º 1
0
 def test_get(self):
     with app.app_context() as context:
         context.push()
         db.session.remove()
         db.drop_all()
         db.create_all()
         self.assertIsNone(Schedules.query.get(1))
Ejemplo n.º 2
0
 def test_post_appoint(self):
     with app.app_context() as context:
         with app.test_client() as client:
             context.push()
             db.session.remove()
             db.drop_all()
             db.create_all()
             response = client.post('/schedule', data=patient1)
             self.assertEqual(response.status_code, 200)
             self.assertEqual(response.json["user_id"], 1)
Ejemplo n.º 3
0
 def test_exist(self):
     with app.app_context() as context:
         context.push()
         db.session.remove()
         db.drop_all()
         db.create_all()
         appoint = SchedulesSchema().make_instance(patient1, partial=False)
         db.session.add(appoint)
         db.session.commit()
         exist = Schedules.query.get(patient1["id"])
         self.assertEqual(appoint.id, exist.id)
Ejemplo n.º 4
0
 def test_get_appoint(self):
     with app.app_context() as context:
         with app.test_client() as client:
             context.push()
             db.session.remove()
             db.drop_all()
             db.create_all()
             appoint = SchedulesSchema().make_instance(patient1, partial=False)
             db.session.add(appoint)
             db.session.commit()
             response = client.get('/schedule/1')
             self.assertEqual(response.status_code, 200)
             self.assertEqual(response.json["user_data"], patient1["user_data"])
Ejemplo n.º 5
0
 def test_delete_appoint(self):
     with app.app_context() as context:
         with app.test_client() as client:
             context.push()
             db.session.remove()
             db.drop_all()
             db.create_all()
             appoint = SchedulesSchema().make_instance(patient1, partial=False)
             db.session.add(appoint)
             db.session.commit()
             response = client.delete('/schedule/1')
             self.assertEqual(response.status_code, 200)
             appoints = Schedules.query.all()
             self.assertEqual(appoints, [])