Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 03597E008FF; Mon, 23 May 2016 13:44:32 -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=-1.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FSL_HELO_HOME,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.1 X-Spam-HAM-Report: * -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low * trust * [74.125.82.54 listed in list.dnswl.org] * 1.0 FSL_HELO_HOME FSL_HELO_HOME * -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-wm0-f54.google.com (mail-wm0-f54.google.com [74.125.82.54]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 1E43DE00855 for ; Mon, 23 May 2016 13:44:27 -0700 (PDT) Received: by mail-wm0-f54.google.com with SMTP id n129so98037134wmn.1 for ; Mon, 23 May 2016 13:44:27 -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=t9xEHcI4QV+PtWE5Sg0hHFxrEHtpxC1U714wH1AyfBY0RC0BGqPWPiUDw1ZxeZbBFR rPYfJbVKObwBGaKaWiYUsnEYgG8ywWokyTApxixjcH7jT/xUud0xXMG2XlAygW8Y1Gb1 gDY6BdKSudf9e/E7olDXKnzFnqCoJQsoOVxq1mrDgDuoybTMC51ung2aj+WAARq2BhXh 8UfNUf0I5oL6k9AxIYhKfKBCbhsRJn4cL1+Dk/fgkiJnQnfGfuhpJPra/tD8EmrMqvTD 2ZFKYgubFqXHxXHXDt6hUiMywzGLzPcGgBSHwuWw6cg3etljHnF1rVNvCAvfZnLUv/d9 0vNA== 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=MQK75M8QFwX/V1+8k1HoOkv9XZmO5AE5wLTQroQkzz2KbG832/yYzHuBkqXlXCUBAy EjIlElTx980zLP/kAEPm05SXXJA3QH/kZtHDtM8svJF+VLG1RvIMrPfQ5OlyWEWjQ3gG f4MCozCKgxJRno/2MJswTs9A8SCmiv8BIhaI9CyPdykcpuD7po0DQ7Yngac7+1cU9j4H wbxjGUEGI9IesV8m26BoIjkxuT4yA7YJOIS3gjJp2npwpDtA1R91KZCTWiQqz9fw78GJ ofQRD2+IM63h2vI8IeBaLuq6BqZ/Yn4gm2VAVVvGiQ4IkCGvGQlALsOQyE1zEcdKCTty Gesw== X-Gm-Message-State: ALyK8tJoJFWqAtraUs/7uNjF8l8aus9YdoBm4n+JAY2SW8SpTLuOxKwlJqzJv25bVwqUx/Ri X-Received: by 10.28.103.2 with SMTP id b2mr8443789wmc.28.1464036267031; Mon, 23 May 2016 13:44:27 -0700 (PDT) Received: from orion.home (host31-48-249-108.range31-48.btcentralplus.com. [31.48.249.108]) by smtp.gmail.com with ESMTPSA id h14sm12035619wme.1.2016.05.23.13.44.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 23 May 2016 13:44:26 -0700 (PDT) From: Michael Wood To: toaster@yoctoproject.org Date: Mon, 23 May 2016 21:44:17 +0100 Message-Id: <1464036257-23434-8-git-send-email-michael.g.wood@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1464036257-23434-1-git-send-email-michael.g.wood@intel.com> References: <1464036257-23434-1-git-send-email-michael.g.wood@intel.com> Subject: [PATCH 7/7] 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: Mon, 23 May 2016 20:44:32 -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