Ejemplo n.º 1
0
 def test_build_get_with_non_exist_product_name(self):
     try:
         build.check_build(None, "B5", "AAAAAAAAAAAAAAAA")
     except Fault as f:
         self.assertEqual(f.faultCode, 404, AssertMessage.SHOULD_BE_404)
     else:
         self.fail(AssertMessage.NOT_VALIDATE_ARGS)
Ejemplo n.º 2
0
 def test_build_get_with_non_exist_product_name(self):
     try:
         build.check_build(None, "B5", "AAAAAAAAAAAAAAAA")
     except Fault as f:
         self.assertEqual(f.faultCode, 404, AssertMessage.SHOULD_BE_404)
     else:
         self.fail(AssertMessage.NOT_VALIDATE_ARGS)
Ejemplo n.º 3
0
 def test_build_get_with_illegal_args(self):
     bad_args = (self, 0.7, False, True, 1, -1, 0, (1,), dict(a=1))
     for arg in bad_args:
         try:
             build.check_build(None, arg, 4)
         except Fault as f:
             self.assertEqual(f.faultCode, 400, AssertMessage.SHOULD_BE_400)
         else:
             self.fail(AssertMessage.NOT_VALIDATE_ARGS)
Ejemplo n.º 4
0
 def test_build_get_with_illegal_args(self):
     bad_args = (self, 0.7, False, True, 1, -1, 0, (1,), dict(a=1))
     for arg in bad_args:
         try:
             build.check_build(None, arg, 4)
         except Fault as f:
             self.assertEqual(f.faultCode, 400, AssertMessage.SHOULD_BE_400)
         else:
             self.fail(AssertMessage.NOT_VALIDATE_ARGS)
Ejemplo n.º 5
0
    def test_build_get_with_empty(self):
        try:
            build.check_build(None, "", 4)
        except Fault as f:
            self.assertEqual(f.faultCode, 400, AssertMessage.SHOULD_BE_400)
        else:
            self.fail(AssertMessage.NOT_VALIDATE_ARGS)

        try:
            build.check_build(None, "         ", 4)
        except Fault as f:
            self.assertEqual(f.faultCode, 400, AssertMessage.SHOULD_BE_400)
        else:
            self.fail(AssertMessage.NOT_VALIDATE_ARGS)
Ejemplo n.º 6
0
    def test_build_get_with_empty(self):
        try:
            build.check_build(None, "", 4)
        except Fault as f:
            self.assertEqual(f.faultCode, 400, AssertMessage.SHOULD_BE_400)
        else:
            self.fail(AssertMessage.NOT_VALIDATE_ARGS)

        try:
            build.check_build(None, "         ", 4)
        except Fault as f:
            self.assertEqual(f.faultCode, 400, AssertMessage.SHOULD_BE_400)
        else:
            self.fail(AssertMessage.NOT_VALIDATE_ARGS)
Ejemplo n.º 7
0
    def test_build_get_with_no_args(self):
        bad_args = (None, [], (), {})
        for arg in bad_args:
            try:
                build.check_build(None, arg, 4)
            except Fault as f:
                self.assertEqual(f.faultCode, 400, AssertMessage.SHOULD_BE_400)
            else:
                self.fail(AssertMessage.NOT_VALIDATE_ARGS)

            try:
                build.check_build(None, "B5", arg)
            except Fault as f:
                self.assertEqual(f.faultCode, 400, AssertMessage.SHOULD_BE_400)
            else:
                self.fail(AssertMessage.NOT_VALIDATE_ARGS)
Ejemplo n.º 8
0
    def test_build_get_with_no_args(self):
        bad_args = (None, [], (), {})
        for arg in bad_args:
            try:
                build.check_build(None, arg, 4)
            except Fault as f:
                self.assertEqual(f.faultCode, 400, AssertMessage.SHOULD_BE_400)
            else:
                self.fail(AssertMessage.NOT_VALIDATE_ARGS)

            try:
                build.check_build(None, "B5", arg)
            except Fault as f:
                self.assertEqual(f.faultCode, 400, AssertMessage.SHOULD_BE_400)
            else:
                self.fail(AssertMessage.NOT_VALIDATE_ARGS)
Ejemplo n.º 9
0
 def test_build_get(self):
     b = build.check_build(None, self.build.name, self.product.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'], 'testing ...')
     self.assertEqual(b['is_active'], True)
Ejemplo n.º 10
0
 def test_build_get(self):
     b = build.check_build(None, self.build.name, self.product.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'], 'testing ...')
     self.assertEqual(b['is_active'], True)
Ejemplo n.º 11
0
 def test_build_get(self):
     try:
         b = build.check_build(None, "B5", 4)
     except Fault as f:
         print f.faultString
         self.fail(AssertMessage.UNEXCEPT_ERROR)
     else:
         self.assertIsNotNone(b)
         self.assertEqual(b['build_id'], 14)
         self.assertEqual(b['name'], "B5")
         self.assertEqual(b['product_id'], 4)
         self.assertEqual(b['description'], "B5")
         self.assertEqual(b['is_active'], True)
Ejemplo n.º 12
0
 def test_build_get(self):
     try:
         b = build.check_build(None, "B5", 4)
     except Fault as f:
         print f.faultString
         self.fail(AssertMessage.UNEXCEPT_ERROR)
     else:
         self.assertIsNotNone(b)
         self.assertEqual(b["build_id"], 14)
         self.assertEqual(b["name"], "B5")
         self.assertEqual(b["product_id"], 4)
         self.assertEqual(b["description"], "B5")
         self.assertEqual(b["is_active"], True)