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(Cards.query.get(1))
Ejemplo n.º 2
0
 def test_post_user_card(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('/cards', 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()
         card = CardSchema().make_instance(patient1, partial=False)
         db.session.add(card)
         db.session.commit()
         exist = Cards.query.get(patient1["id"])
         self.assertEqual(card.id, exist.id)
Ejemplo n.º 4
0
 def test_update_user_card(self):
     with app.app_context() as context:
         with app.test_client() as client:
             context.push()
             db.session.remove()
             db.drop_all()
             db.create_all()
             card = CardSchema().make_instance(patient1, partial=False)
             db.session.add(card)
             db.session.commit()
             response = client.put('/cards/1', data=patient1_update)
             self.assertEqual(response.status_code, 200)
             self.assertEqual(response.json["dd"], 18)