Esempio n. 1
0
 def builds(self):
     from tcms.apps.management.models import TestBuild
     query = {
         'product_id': self.product_id,
         'is_active': self.request.REQUEST.get('is_active')
     }
     return TestBuild.list(query)
Esempio n. 2
0
 def builds(self):
     from tcms.apps.management.models import TestBuild
     query = {
         'product_id': self.product_id,
         'is_active': self.request.REQUEST.get('is_active')
     }
     return TestBuild.list(query)
Esempio n. 3
0
 def populate(self, product_id):
     # We can dynamically set choices for a form field:
     # Seen at: http://my.opera.com/jacob7908/blog/2009/06/19/django-choicefield-queryset (Chinese)
     # Is this documented elsewhere?
     query = {'product_id': product_id}
     self.fields['product_version'].queryset = Version.objects.filter(product__id = product_id)
     self.fields['build'].queryset = TestBuild.list_active(query)
Esempio n. 4
0
 def populate(self, product_id):
     # We can dynamically set choices for a form field:
     # Seen at: http://my.opera.com/jacob7908/blog/2009/06/19/django-choicefield-queryset (Chinese)
     # Is this documented elsewhere?
     query = {'product_id': product_id}
     self.fields['product_version'].queryset = Version.objects.filter(
         product__id=product_id)
     self.fields['build'].queryset = TestBuild.list_active(query)
Esempio n. 5
0
    def test_to_xmlrpc(self):
        result = TestBuild.to_xmlrpc(query={'pk': self.test_build.pk})
        self.assertEqual(len(result), 1)

        # Verify all fields are serialized correctly
        sample_testbuild = result[0]
        sample_fields = set([name for name in sample_testbuild.keys()])
        test_fields = set(self.test_fields)
        test_result = list(sample_fields ^ test_fields)
        self.assertEqual(test_result, [])

        sample_tb = result[0]
        self.assertEqual(self.test_build.name, sample_tb['name'])
        self.assertEqual(self.test_build.product.pk, sample_tb['product_id'])
        self.assertEqual(self.test_build.product.name, sample_tb['product'])
        self.assertEqual(self.test_build.milestone, sample_tb['milestone'])
        self.assertEqual(self.test_build.is_active, sample_tb['is_active'])
Esempio n. 6
0
def get_builds(request, product, is_active = True):
    """
    Description: Get the list of builds associated with this product.

    Params:      $product  -  Integer/String
                              Integer: product_id of the product in the Database
                              String: Product name
                 $is_active - Boolean: True to only include builds where is_active is true.
                              Default: True
    Returns:     Array: Returns an array of Build objects.

    Example:
    # Get with product id including all builds
    >>> Product.get_builds(61)
    # Get with product name excluding all inactive builds
    >>> Product.get_builds('Red Hat Enterprise Linux 5', 0)
    """
    from tcms.apps.management.models import TestBuild

    p = pre_check_product(values = product)
    query = {'product': p, 'is_active': is_active}
    return TestBuild.to_xmlrpc(query)
Esempio n. 7
0
def get_builds(request, product, is_active=True):
    """
    Description: Get the list of builds associated with this product.

    Params:      $product  -  Integer/String
                              Integer: product_id of the product in the Database
                              String: Product name
                 $is_active - Boolean: True to only include builds where is_active is true.
                              Default: True
    Returns:     Array: Returns an array of Build objects.

    Example:
    # Get with product id including all builds
    >>> Product.get_builds(61)
    # Get with product name excluding all inactive builds
    >>> Product.get_builds('Red Hat Enterprise Linux 5', 0)
    """
    from tcms.apps.management.models import TestBuild

    p = pre_check_product(values=product)
    query = {'product': p, 'is_active': is_active}
    return TestBuild.to_xmlrpc(query)
Esempio n. 8
0
 def __init__(self, author, plan, *args, **kwargs):
     super(NewReviewForm, self).__init__(*args, **kwargs)
     self.plan = plan
     self.author = author
     query = {'product_id': self.plan.product_id}
     self.fields['build'].queryset = TestBuild.list_active(query)
Esempio n. 9
0
 def __init__(self, author, plan, *args, **kwargs):
     super(NewReviewForm, self).__init__(*args, **kwargs)
     self.plan = plan
     self.author = author
     query = {'product_id': self.plan.product_id}
     self.fields['build'].queryset = TestBuild.list_active(query)