コード例 #1
0
 def test_post(self):
     gsr = GatewayFixCreateResource()
     res = gsr.post()
     self.assertEqual(res.status_code, 201)
     sr = FixResource()
     mag = Fix.from_json(res.data)
     sr.delete(str(mag.id))
コード例 #2
0
 def test_post(self):
     sr = FixCreateResource()
     res = sr.post()
     self.assertEqual(res.status_code, 201)
     sr1 = FixResource()
     fix = Fix.from_json(res.data)
     sr1.delete(str(fix.id))
コード例 #3
0
 def test_get_right(self):
     scr = FixCreateResource()
     sr = FixResource()
     res = scr.post()
     fix = Fix.from_json(res.data)
     res = sr.get(str(fix.id))
     self.assertEqual(res.status_code, 200)
     sr.delete(str(fix.id))
コード例 #4
0
 def test_patch_add_right(self):
     sr = FixResource()
     scr = FixCreateResource()
     res = scr.post()
     fix = Fix.from_json(res.data)
     mr = MechanicResource()
     mcr = MechanicCreateResource()
     resm = mcr.post()
     meh = Mechanic.from_json(resm.data)
     payload = {'meh_id': meh.id, 'status': 'mehadd'}
     res = requests.patch(current_config.GATEWAY_URL +
                          current_config.GATEWAY_PATH + '/fixes/add' +
                          '/%s' % fix.id,
                          data=jsonpickle.encode(payload))
     self.assertEqual(res.status_code, 201)
     sr.delete(str(fix.id))
     mr.delete(str(meh.id))
コード例 #5
0
 def test_delete_right(self):
     sr = FixResource()
     ur = UserResource()
     scr = FixCreateResource()
     r = scr.post()
     fix = Fix.from_json(r.data)
     u = UserCreateResource()
     us = u.post()
     user = User.from_json(us.data)
     payload = {'fix_id': fix.id, 'name': 'suzuki', 'user_id': user.id}
     res = requests.post(current_config.GATEWAY_URL +
                         current_config.GATEWAY_PATH + '/cars/add',
                         data=jsonpickle.encode(payload))
     #sr.delete(fix.id)
     car = Car.from_json(res.content)
     ret_prod = GatewayReturnCar()
     res = ret_prod.delete(car.id)
     self.assertEqual(res.status_code, 204)
     ur.delete(user.id)
     sr.delete(fix.id)
コード例 #6
0
 def test_delete_error(self):
     sr = FixResource()
     try:
         res = sr.delete("5bd0a351")
     except:
         self.assertTrue(True)
コード例 #7
0
 def test_get_error(self):
     sr = FixResource()
     try:
         res = sr.get("5bd0a351")
     except:
         self.assertTrue(True)