Ejemplo n.º 1
0
    def test_check_category_with_non_exist(self):
        try:
            product.check_category(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_category(None, "--default--", 9999)
        except Fault as f:
            self.assertEqual(f.faultCode, 404, AssertMessage.SHOULD_BE_404)
        else:
            self.fail(AssertMessage.UNEXCEPT_ERROR)
Ejemplo n.º 2
0
 def test_check_category(self):
     try:
         cat = product.check_category(None, "--default--", 1)
     except Fault:
         self.fail(AssertMessage.UNEXCEPT_ERROR)
     else:
         self.assertEqual(cat['name'], "--default--")
Ejemplo n.º 3
0
    def test_check_category_with_no_args(self):
        bad_args = (None, [], {}, ())
        for arg in bad_args:
            try:
                product.check_category(None, "--default--", 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_category(None, arg, "--default--")
            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 lookup_category_id_by_name(request, name, product):
    """Lookup category ID by name

    .. deprecated:: x.y

       Use :meth:`Product.check_category <tcms.xmlrpc.api.product.check_category>` instead.
    """
    from tcms.xmlrpc.api.product import check_category

    return check_category(request=request, name=name, product=product)
Ejemplo n.º 5
0
def lookup_category_id_by_name(request, name, product):
    """Lookup category ID by name

    .. deprecated:: x.y

       Use :meth:`Product.check_category <tcms.xmlrpc.api.product.check_category>` instead.
    """
    from tcms.xmlrpc.api.product import check_category

    return check_category(request=request, name=name, product=product)
Ejemplo n.º 6
0
 def test_check_category(self):
     cat = product.check_category(None, 'manual', self.product_nitrate.pk)
     self.assertEqual(cat['name'], 'manual')
Ejemplo n.º 7
0
 def test_check_category(self):
     cat = product.check_category(None, 'manual', self.product_nitrate.pk)
     self.assertEqual(cat['name'], 'manual')