示例#1
0
 def test_build_get_with_non_exist_id(self):
     try:
         build.get(None, 9999)
     except Fault as f:
         self.assertEqual(f.faultCode, 404, AssertMessage.SHOULD_BE_404)
     else:
         self.fail(AssertMessage.NOT_VALIDATE_ARGS)
示例#2
0
 def test_build_get_with_non_exist_id(self):
     try:
         build.get(None, 9999)
     except Fault as f:
         self.assertEqual(f.faultCode, 404, AssertMessage.SHOULD_BE_404)
     else:
         self.fail(AssertMessage.NOT_VALIDATE_ARGS)
示例#3
0
 def test_build_get_with_non_integer(self):
     bad_args = (True, False, (1,), dict(a=1), -1, 0.7, "", "AA")
     for arg in bad_args:
         try:
             build.get(None, arg)
         except Fault as f:
             self.assertEqual(f.faultCode, 400, AssertMessage.SHOULD_BE_400)
         else:
             self.fail(AssertMessage.NOT_VALIDATE_ARGS)
示例#4
0
 def test_build_get_with_no_args(self):
     bad_args = (None, [], (), {})
     for arg in bad_args:
         try:
             build.get(None, arg)
         except Fault as f:
             self.assertEqual(f.faultCode, 400, AssertMessage.SHOULD_BE_400)
         else:
             self.fail(AssertMessage.NOT_VALIDATE_ARGS)
示例#5
0
 def test_build_get_with_non_integer(self):
     bad_args = (True, False, (1,), dict(a=1), -1, 0.7, "", "AA")
     for arg in bad_args:
         try:
             build.get(None, arg)
         except Fault as f:
             self.assertEqual(f.faultCode, 400, AssertMessage.SHOULD_BE_400)
         else:
             self.fail(AssertMessage.NOT_VALIDATE_ARGS)
示例#6
0
 def test_build_get_with_no_args(self):
     bad_args = (None, [], (), {})
     for arg in bad_args:
         try:
             build.get(None, arg)
         except Fault as f:
             self.assertEqual(f.faultCode, 400, AssertMessage.SHOULD_BE_400)
         else:
             self.fail(AssertMessage.NOT_VALIDATE_ARGS)
示例#7
0
 def test_build_get_with_id(self):
     b = build.get(None, self.build.pk)
     self.assertIsNotNone(b)
     self.assertEqual(b['build_id'], self.build.pk)
     self.assertEqual(b['name'], self.build.name)
     self.assertEqual(b['product_id'], self.product.pk)
     self.assertEqual(b['description'], 'for testing')
     self.assertTrue(b['is_active'])
示例#8
0
 def test_build_get_with_id(self):
     b = build.get(None, self.build.pk)
     self.assertIsNotNone(b)
     self.assertEqual(b['build_id'], self.build.pk)
     self.assertEqual(b['name'], self.build.name)
     self.assertEqual(b['product_id'], self.product.pk)
     self.assertEqual(b['description'], 'for testing')
     self.assertTrue(b['is_active'])
示例#9
0
 def test_build_get_with_id(self):
     try:
         b = build.get(None, 10)
     except Fault as f:
         print f.faultString
         self.fail(AssertMessage.UNEXCEPT_ERROR)
     else:
         self.assertIsNotNone(b)
         self.assertEqual(b['build_id'], 10)
         self.assertEqual(b['name'], "B1")
         self.assertEqual(b['product_id'], 4)
         self.assertEqual(b['description'], "B1")
         self.assertEqual(b['is_active'], True)
示例#10
0
 def test_build_get_with_id(self):
     try:
         b = build.get(None, 10)
     except Fault as f:
         print f.faultString
         self.fail(AssertMessage.UNEXCEPT_ERROR)
     else:
         self.assertIsNotNone(b)
         self.assertEqual(b["build_id"], 10)
         self.assertEqual(b["name"], "B1")
         self.assertEqual(b["product_id"], 4)
         self.assertEqual(b["description"], "B1")
         self.assertEqual(b["is_active"], True)