Esempio n. 1
0
 def test_build_update_with_no_perms(self):
     try:
         build.update(self.staff_request, 1, {})
     except Fault as f:
         self.assertEqual(f.faultCode, 403, AssertMessage.SHOULD_BE_403)
     else:
         self.fail(AssertMessage.NOT_VALIDATE_ARGS)
Esempio n. 2
0
 def test_build_update_with_non_exist_build(self):
     try:
         build.update(self.admin_request, 999, {})
     except Fault as f:
         self.assertEqual(f.faultCode, 404, AssertMessage.SHOULD_BE_404)
     else:
         self.fail(AssertMessage.NOT_VALIDATE_ARGS)
Esempio n. 3
0
 def test_build_update_with_multi_id(self):
     try:
         build.update(self.admin_request, (1, 2, 3), {})
     except Fault as f:
         self.assertEqual(f.faultCode, 400, AssertMessage.SHOULD_BE_400)
     else:
         self.fail(AssertMessage.NOT_VALIDATE_ARGS)
Esempio n. 4
0
 def test_build_update_with_non_exist_product_name(self):
     try:
         build.update(self.admin_request, 1, {"product": "AAAAAAAAAAAAAA"})
     except Fault as f:
         self.assertEqual(f.faultCode, 404, AssertMessage.SHOULD_BE_404)
     else:
         self.fail(AssertMessage.NOT_VALIDATE_ARGS)
Esempio n. 5
0
 def test_build_update_with_multi_id(self):
     try:
         build.update(self.admin_request, (1, 2, 3), {})
     except Fault as f:
         self.assertEqual(f.faultCode, 400, AssertMessage.SHOULD_BE_400)
     else:
         self.fail(AssertMessage.NOT_VALIDATE_ARGS)
Esempio n. 6
0
 def test_build_update_with_no_perms(self):
     try:
         build.update(self.staff_request, 1, {})
     except Fault as f:
         self.assertEqual(f.faultCode, 403, AssertMessage.SHOULD_BE_403)
     else:
         self.fail(AssertMessage.NOT_VALIDATE_ARGS)
Esempio n. 7
0
 def test_build_update_with_non_integer(self):
     bad_args = (True, False, (1,), dict(a=1), -1, 0.7, "", "AA")
     for arg in bad_args:
         try:
             build.update(self.admin_request, arg, {})
         except Fault as f:
             self.assertEqual(f.faultCode, 400, AssertMessage.SHOULD_BE_400)
         else:
             self.fail(AssertMessage.NOT_VALIDATE_ARGS)
Esempio n. 8
0
 def test_build_update_with_non_integer(self):
     bad_args = (True, False, (1,), dict(a=1), -1, 0.7, "", "AA")
     for arg in bad_args:
         try:
             build.update(self.admin_request, arg, {})
         except Fault as f:
             self.assertEqual(f.faultCode, 400, AssertMessage.SHOULD_BE_400)
         else:
             self.fail(AssertMessage.NOT_VALIDATE_ARGS)
Esempio n. 9
0
    def test_build_update_with_no_args(self):
        bad_args = (None, [], (), {})
        for arg in bad_args:
            try:
                build.update(self.admin_request, arg, {})
            except Fault as f:
                self.assertEqual(f.faultCode, 400, AssertMessage.SHOULD_BE_400)
            else:
                self.fail(AssertMessage.NOT_VALIDATE_ARGS)

            try:
                build.update(self.admin_request, 1, {})
            except Fault as f:
                self.assertEqual(f.faultCode, 400, AssertMessage.SHOULD_BE_400)
            else:
                self.fail(AssertMessage.NOT_VALIDATE_ARGS)
Esempio n. 10
0
    def test_build_update_with_no_args(self):
        bad_args = (None, [], (), {})
        for arg in bad_args:
            try:
                build.update(self.admin_request, arg, {})
            except Fault as f:
                self.assertEqual(f.faultCode, 400, AssertMessage.SHOULD_BE_400)
            else:
                self.fail(AssertMessage.NOT_VALIDATE_ARGS)

            try:
                build.update(self.admin_request, 1, {})
            except Fault as f:
                self.assertEqual(f.faultCode, 400, AssertMessage.SHOULD_BE_400)
            else:
                self.fail(AssertMessage.NOT_VALIDATE_ARGS)
Esempio n. 11
0
 def test_build_update(self):
     b = build.update(self.admin_request, self.build_3.pk, {
         "product": self.another_product.pk,
         "name": "Update",
         "description": "Update from unittest."
     })
     self.assertIsNotNone(b)
     self.assertEqual(b['product_id'], self.another_product.pk)
     self.assertEqual(b['name'], 'Update')
     self.assertEqual(b['description'], 'Update from unittest.')
Esempio n. 12
0
 def test_build_update(self):
     b = build.update(self.admin_request, self.build_3.pk, {
         "product": self.another_product.pk,
         "name": "Update",
         "description": "Update from unittest."
     })
     self.assertIsNotNone(b)
     self.assertEqual(b['product_id'], self.another_product.pk)
     self.assertEqual(b['name'], 'Update')
     self.assertEqual(b['description'], 'Update from unittest.')
Esempio n. 13
0
 def test_build_update(self):
     try:
         b = build.update(
             self.admin_request, 3, {"product": 1, "name": "Update", "description": "Update from unittest."}
         )
     except Fault as f:
         print f.faultString
         self.fail(AssertMessage.UNEXCEPT_ERROR)
     else:
         self.assertIsNotNone(b)
         self.assertEqual(b["product_id"], 1)
         self.assertEqual(b["name"], "Update")
         self.assertEqual(b["description"], "Update from unittest.")
Esempio n. 14
0
 def test_build_update(self):
     try:
         b = build.update(self.admin_request, 3, {
             "product": 1,
             "name": "Update",
             "description": "Update from unittest."
         })
     except Fault as f:
         print f.faultString
         self.fail(AssertMessage.UNEXCEPT_ERROR)
     else:
         self.assertIsNotNone(b)
         self.assertEqual(b['product_id'], 1)
         self.assertEqual(b['name'], 'Update')
         self.assertEqual(b['description'], 'Update from unittest.')