Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id DCEC7E00BE9; Tue, 8 Dec 2015 13:18:30 -0800 (PST) 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.220.49 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-pa0-f49.google.com (mail-pa0-f49.google.com [209.85.220.49]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 7396BE00C20 for ; Tue, 8 Dec 2015 13:18:01 -0800 (PST) Received: by pacej9 with SMTP id ej9so17873249pac.2 for ; Tue, 08 Dec 2015 13:18:01 -0800 (PST) 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=C5V1hG8blV7GY3QDBwSIaWXOT177RyLHGHzwrxQWGbA=; b=dHQIWZozFw12zEF1xlk7DA04kq4BNW4Wd3sYS7zcucAZF7QKgV+dPLYyt4xiwSj5Qd FePwh14Dj7mL+QVCNt4X/ELTwE6vVBrLm2ZWZfAalsw25wYAS1Z1DSPR8Anl4AfDBmzn d0dTaxgUO/PSeP1SiUtEd+8U5IRBP4ybi2szYn58wamW3w/21Nqunw+rbE0mNKS2R29F DGcsHtQwH8JI56FgDdPymCNe0cz/U00fSt1dsb5jt5BdepToeC6q9C98i5K53miSsoHM ZP1MwIrbsVkqz5wpS2xK6HP2kwVIlNf8w8DaFSCUiScNrxQ3c/DWuOoNIUJ6WNS/QKWk 5rsw== 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=C5V1hG8blV7GY3QDBwSIaWXOT177RyLHGHzwrxQWGbA=; b=As1UzaKJBxlrIbaG6n3311ZdX9shne3sxwu/rOxzE2xAUE7zuvvnhhk5k/gEyy1gZA W5viw2a2u5CM51kLlLZe4mLXwQAJJgmg65CcXKbt2uVzn+LgOjgvUmoJTa1V/PzAICC0 fpcmUaNL9YTuqQMEe/z1B+wszGG7xRTj5lFNvU7T+ADLq9WaY3T2Oyy4t34L1+IOf90s BYTW6zX5VaW2PRgyDY2iR7UDKQuprIDEQkcCo5DYZil71bUTm6stvFos5AZRR4xLHK/0 ZIq35H/98wGZ0ArVllGhcVS05cycxSB27lnu2KNeB3e7gbSCaBy0VJywNqXZutpvmscY HSdw== X-Gm-Message-State: ALoCoQmy6ylnBdwSLuNhA8SZtPjY/Cc1ch79w7K6AGArYla6yIuEuP24cHdyUhdoCSnsesVUIKinvfltb/FdRJ88cGxzTIezuw== X-Received: by 10.66.193.36 with SMTP id hl4mr2937876pac.153.1449609481299; Tue, 08 Dec 2015 13:18:01 -0800 (PST) Received: from draco.ger.corp.intel.com ([192.55.54.40]) by smtp.gmail.com with ESMTPSA id v64sm6675766pfi.50.2015.12.08.13.17.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 08 Dec 2015 13:18:00 -0800 (PST) From: Michael Wood To: toaster@yoctoproject.org Date: Tue, 8 Dec 2015 21:16:18 +0000 Message-Id: <1449609380-11073-33-git-send-email-michael.g.wood@intel.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1449609380-11073-1-git-send-email-michael.g.wood@intel.com> References: <1449609380-11073-1-git-send-email-michael.g.wood@intel.com> Subject: [PATCH 32/34] toaster: toastergui tests Update package test to use ProjectPackage 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: Tue, 08 Dec 2015 21:18:30 -0000 Update test for adding and removing a package from a CustomImageRecipe so that it uses the ProjectPackage and correct fields for the packages included. Change the test for error condition to use an invalid package id as ManyToMany remove() on package that isn't in the relationship does not throw an error. Signed-off-by: Michael Wood --- bitbake/lib/toaster/toastergui/tests.py | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/bitbake/lib/toaster/toastergui/tests.py b/bitbake/lib/toaster/toastergui/tests.py index 3683b51..d0e4676 100644 --- a/bitbake/lib/toaster/toastergui/tests.py +++ b/bitbake/lib/toaster/toastergui/tests.py @@ -30,7 +30,7 @@ from orm.models import Project, Release, BitbakeVersion, Package, LogMessage from orm.models import ReleaseLayerSourcePriority, LayerSource, Layer, Build from orm.models import Layer_Version, Recipe, Machine, ProjectLayer, Target from orm.models import CustomImageRecipe, ProjectVariable -from orm.models import Branch +from orm.models import Branch, ProjectPackage import toastermain import inspect @@ -141,6 +141,11 @@ class ViewTests(TestCase): Package.objects.create(name='zpkg1', recipe=self.recipe1, build=build) + self.project_package = ProjectPackage.objects.create( + name="ppkg1", + recipe=self.recipe1, + project=self.project) + # recipe with project for testing AvailableRecipe table self.recipe2 = Recipe.objects.create(layer_source=layersrc, name="fancy-recipe", @@ -377,24 +382,27 @@ class ViewTests(TestCase): # add self.package to recipe response = self.client.put(reverse('xhr_customrecipe_packages', args=(self.customr.id, - self.package.id))) + self.project_package.id))) self.assertEqual(response.status_code, 200) self.assertEqual(json.loads(response.content), - {"error": "ok", - "dependencies_needed": []}) - self.assertEqual(self.customr.package_set.first().name, - self.package.name) + {"error": "ok"}) + self.assertEqual(self.customr.appends_set.first().name, + self.project_package.name) # delete it del_url = reverse('xhr_customrecipe_packages', args=(self.customr.id, - self.customr.package_set.first().id)) + self.customr.appends_set.first().id)) response = self.client.delete(del_url) self.assertEqual(response.status_code, 200) self.assertEqual(json.loads(response.content), {"error": "ok"}) - self.assertFalse(self.customr.package_set.all()) - # delete it again to test error condition + self.assertFalse(self.customr.includes_set.all()) + # delete invalid package to test error condition + del_url = reverse('xhr_customrecipe_packages', + args=(self.customr.id, + 99999)) + response = self.client.delete(del_url) self.assertEqual(response.status_code, 200) self.assertNotEqual(json.loads(response.content)["error"], "ok") -- 2.1.4