Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 3535EE00DD7; Thu, 26 May 2016 08:13:10 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low * trust * [209.85.192.177 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily * valid * -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Received: from mail-pf0-f177.google.com (mail-pf0-f177.google.com [209.85.192.177]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 09D2BE00DFE for ; Thu, 26 May 2016 08:12:46 -0700 (PDT) Received: by mail-pf0-f177.google.com with SMTP id y69so31797590pfb.1 for ; Thu, 26 May 2016 08:12:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=gOM0IrDaq/Z0Pw5dtFUtDFOy8A/ceVXZxRUF0Z5xPqk=; b=n5n4sjxBrpX9D8aMGn+1qYHV+8bh/a8k2rQ7p709ZokPuXBgL18xxE7AVP/ZZHpD3i pE/JROfzpJnu5guQGOl3K2s4RWsjDrYfmV5AZ/BETmg2aq59rHrp24JHyiZ1lP+F4ps4 fDe5/R2IgxkSs+UyPmMD6OQhAUpag0KZOHZeyqCdjYp+SG8TII3X4SovXSidLbbGM0/s 2UyMZxGRtJHbWDbLJJRLVSUHv96dBpZ6m5bSQHwZua4s+1zrHt3Sk6iLU70Lh3I5JlR1 HVCKSWVAV0xe+bsul/yH6VUUDwA/rKdMBWLB7UmocZ5U/31eescu1hoRV2vSB8QD3XxW rN1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=gOM0IrDaq/Z0Pw5dtFUtDFOy8A/ceVXZxRUF0Z5xPqk=; b=PmV8eCLzAc/3cmlZL/laodncYNlWdHBVwApkGmGr/sI//NHRmq3DLX2ABCJIEA2202 P9wMqwBHFFva/QEhnYm07KC6Px6xWJXhZe8raIFxM6qDoHf94lJVZXTUbk4QvbdOWoUk MOS/bI37Z2GJ2KZ4sAhjQF+Khhs/GtpMCHOO3gtIXX2/EFGnzKQ346d7oCf+euVw0F+7 V0WtKLHFduDcFWdxPsAfymWfPeS/lj04LadBbO6kQyBM3QWCELYOEiQ/oNdc0mTXHb5U n8nOXc5IKdbvmftotffQaVxNSOTFCiIHNbisN9PU5uTH3fKDaZkJKVKFdavf/4fqAgRI 085g== X-Gm-Message-State: ALyK8tI5kCZ8m/ubXCRZUi0mwtsT9N5rCeQGfErNgJnFpp7pzPj3g7zREEkqhrQrghNqM1LY X-Received: by 10.98.1.132 with SMTP id 126mr14661983pfb.27.1464275566322; Thu, 26 May 2016 08:12:46 -0700 (PDT) Received: from orion.ger.corp.intel.com ([192.55.54.45]) by smtp.gmail.com with ESMTPSA id l67sm6888008pfi.10.2016.05.26.08.12.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 26 May 2016 08:12:45 -0700 (PDT) From: Michael Wood To: toaster@yoctoproject.org Date: Thu, 26 May 2016 16:12:25 +0100 Message-Id: <1464275547-30446-8-git-send-email-michael.g.wood@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1464275547-30446-1-git-send-email-michael.g.wood@intel.com> References: <1464275547-30446-1-git-send-email-michael.g.wood@intel.com> Subject: [PATCH v2 7/9] toaster: tests Add new build tables to tests X-BeenThere: toaster@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Web based interface for BitBake List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 May 2016 15:13:10 -0000 - Add new build tables to be tested - Add required data into the fixture and clean up a few empty fields - Fix the SoftwareRecipesTable specific test so as not to rely on two particular defined recipes Signed-off-by: Michael Wood --- .../fixtures/toastergui-unittest-data.xml | 91 ++++++++++++++++------ bitbake/lib/toaster/toastergui/tests.py | 40 ++++++---- 2 files changed, 94 insertions(+), 37 deletions(-) diff --git a/bitbake/lib/toaster/toastergui/fixtures/toastergui-unittest-data.xml b/bitbake/lib/toaster/toastergui/fixtures/toastergui-unittest-data.xml index cf35be4..213bf0f 100644 --- a/bitbake/lib/toaster/toastergui/fixtures/toastergui-unittest-data.xml +++ b/bitbake/lib/toaster/toastergui/fixtures/toastergui-unittest-data.xml @@ -82,9 +82,8 @@ 1 a image recipe - False - 0 - + True + 290 2 @@ -118,9 +117,9 @@ 1 - 2 + 1 f pkg - + f @@ -297,6 +296,16 @@ False + + + g recipe + 1.2.3 + 3 + g license + /g + False + + @@ -353,8 +362,6 @@ 1 - - master @@ -363,13 +370,7 @@ a layer - /tmp/ - - - - - 1 @@ -378,21 +379,16 @@ z layer git://two/ - - - - - - + 1 1 1 1 - - master + master + abcdef123 /tmp/ 0 / @@ -405,8 +401,22 @@ 1 - - master + testing-branch + 9876fedcba + + 0 + / + + + + 1 + 2 + 1 + + + 1 + testing-branch + 9876fedcba 0 / @@ -443,4 +453,39 @@ + + + 1 + 1 + False + -1 + abcdef123 + 34/wefw.tar + 1 + a_do_compile + 100 + 10 + 11 + 12 + 10.1 + 10.2 + 3 + + + 1 + 2 + True + 2 + 85bccb7802fd5f48 + 85/sstarpm.tgz + 2 + z_do_package_write_rpm + 245 + 12424 + 23423 + 83943 + 20394.3 + 5363.3 + 1 + diff --git a/bitbake/lib/toaster/toastergui/tests.py b/bitbake/lib/toaster/toastergui/tests.py index 869c39d..9af1018 100644 --- a/bitbake/lib/toaster/toastergui/tests.py +++ b/bitbake/lib/toaster/toastergui/tests.py @@ -25,6 +25,7 @@ from django.test import TestCase from django.test.client import RequestFactory from django.core.urlresolvers import reverse from django.utils import timezone +from django.db.models import Q from orm.models import Project, Release, BitbakeVersion, Package, LogMessage from orm.models import ReleaseLayerSourcePriority, LayerSource, Layer, Build @@ -57,7 +58,6 @@ class ViewTests(TestCase): self.project = Project.objects.first() self.recipe1 = Recipe.objects.get(pk=2) - self.recipe2 = Recipe.objects.last() self.customr = CustomImageRecipe.objects.first() self.cust_package = CustomImagePackage.objects.first() self.package = Package.objects.first() @@ -311,7 +311,6 @@ class ViewTests(TestCase): self.assertEqual(response.status_code, 200) - def test_software_recipes_table(self): """Test structure returned for Software RecipesTable""" table = SoftwareRecipesTable() @@ -319,27 +318,35 @@ class ViewTests(TestCase): response = table.get(request, pid=self.project.id) data = json.loads(response.content) + recipes = Recipe.objects.filter(Q(is_image=False)) + self.assertTrue(len(recipes) > 1, + "Need more than one software recipe to test " + "SoftwareRecipesTable") + + recipe1 = recipes[0] + recipe2 = recipes[1] + rows = data['rows'] - row1 = next(x for x in rows if x['name'] == self.recipe1.name) - row2 = next(x for x in rows if x['name'] == self.recipe2.name) + row1 = next(x for x in rows if x['name'] == recipe1.name) + row2 = next(x for x in rows if x['name'] == recipe2.name) self.assertEqual(response.status_code, 200, 'should be 200 OK status') # check other columns have been populated correctly - self.assertTrue(self.recipe1.name in row1['name']) - self.assertTrue(self.recipe1.version in row1['version']) - self.assertTrue(self.recipe1.description in + self.assertTrue(recipe1.name in row1['name']) + self.assertTrue(recipe1.version in row1['version']) + self.assertTrue(recipe1.description in row1['get_description_or_summary']) - self.assertTrue(self.recipe1.layer_version.layer.name in + self.assertTrue(recipe1.layer_version.layer.name in row1['layer_version__layer__name']) - self.assertTrue(self.recipe2.name in row2['name']) - self.assertTrue(self.recipe2.version in row2['version']) - self.assertTrue(self.recipe2.description in + self.assertTrue(recipe2.name in row2['name']) + self.assertTrue(recipe2.version in row2['version']) + self.assertTrue(recipe2.description in row2['get_description_or_summary']) - self.assertTrue(self.recipe2.layer_version.layer.name in + self.assertTrue(recipe2.layer_version.layer.name in row2['layer_version__layer__name']) def test_toaster_tables(self): @@ -360,7 +367,9 @@ class ViewTests(TestCase): 'layerid': self.lver.pk, 'recipeid': self.recipe1.pk, 'recipe_id': image_recipe.pk, - 'custrecipeid': self.customr.pk} + 'custrecipeid': self.customr.pk, + 'build_id': 1, + 'target_id': 1} response = table.get(request, **args) return json.loads(response.content) @@ -386,11 +395,14 @@ class ViewTests(TestCase): # Get a list of classes in tables module tables = inspect.getmembers(toastergui.tables, inspect.isclass) + tables.extend(inspect.getmembers(toastergui.buildtables, + inspect.isclass)) for name, table_cls in tables: # Filter out the non ToasterTables from the tables module if not issubclass(table_cls, toastergui.widgets.ToasterTable) or \ - table_cls == toastergui.widgets.ToasterTable: + table_cls == toastergui.widgets.ToasterTable or \ + 'Mixin' in name: continue # Get the table data without any options, this also does the -- 2.7.4