示例#1
0
文件: tests.py 项目: jccode/partsms
 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)
示例#2
0
文件: tests.py 项目: jccode/partsms
 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