Exemplo n.º 1
0
    def test_check_component_with_non_exist(self):
        try:
            product.check_component(None, "NonExist", 1)
        except Fault as f:
            self.assertEqual(f.faultCode, 404, AssertMessage.SHOULD_BE_404)
        else:
            self.fail(AssertMessage.UNEXCEPT_ERROR)

        try:
            product.check_component(None, "P", 9999)
        except Fault as f:
            self.assertEqual(f.faultCode, 404, AssertMessage.SHOULD_BE_404)
        else:
            self.fail(AssertMessage.UNEXCEPT_ERROR)
Exemplo n.º 2
0
 def test_check_component(self):
     try:
         cat = product.check_component(None, "P", 1)
     except Fault:
         self.fail(AssertMessage.UNEXCEPT_ERROR)
     else:
         self.assertEqual(cat['name'], "P")
Exemplo n.º 3
0
    def test_check_component_with_no_args(self):
        bad_args = (None, [], {}, ())
        for arg in bad_args:
            try:
                product.check_component(None, "P", arg)
            except Fault as f:
                self.assertEqual(f.faultCode, 400, AssertMessage.SHOULD_BE_400)
            else:
                self.fail(AssertMessage.NOT_VALIDATE_ARGS)

        for arg in bad_args:
            try:
                product.check_component(None, arg, "P")
            except Fault as f:
                self.assertEqual(f.faultCode, 400, AssertMessage.SHOULD_BE_400)
            else:
                self.fail(AssertMessage.NOT_VALIDATE_ARGS)
Exemplo n.º 4
0
 def test_check_component(self):
     cat = product.check_component(None, 'application',
                                   self.product_nitrate.pk)
     self.assertEqual(cat['name'], 'application')
Exemplo n.º 5
0
 def test_check_component(self):
     cat = product.check_component(None, 'application', self.product_nitrate.pk)
     self.assertEqual(cat['name'], 'application')