Beispiel #1
0
 def test_parts_request_deserialize_with_not_exist_num(self):
     json = json_data.replace('9528', '9999')
     data = JSONParser().parse(BytesIO(json))
     ser = PartsRequestSerializer(data=data)
     self.assertTrue(ser.is_valid())
     e = Employee.objects.get(num='9999')
     self.assertNotEqual(e, None)
Beispiel #2
0
 def test_parts_request_deserialize(self):
     json = json_data
     data = JSONParser().parse(BytesIO(json))
     ser = PartsRequestSerializer(data=data)
     self.assertTrue(ser.is_valid())
     ser.save()
     preq = ser.object
     self.assertEqual(preq.request_no, "A201404001024") # request_no
     self.assertEqual(preq.approver, u"101,102")        # approver
     self.assertEqual(preq.requestdetail_set.count(), 2) # request detail