Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id BF92EE0070F; Tue, 8 Dec 2015 13:17:55 -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.192.181 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-f181.google.com (mail-pf0-f181.google.com [209.85.192.181]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 68482E00B05 for ; Tue, 8 Dec 2015 13:17:27 -0800 (PST) Received: by pfdd184 with SMTP id d184so17921986pfd.3 for ; Tue, 08 Dec 2015 13:17:27 -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=lpDy/FCM+s1wbdf3TeRDRBRE0cuHqNCdmWB8qqRhEgo=; b=E1KlvIaOSrasLabzo9udJyizc3nuyVjwF4wfV7pR8HoLS18WoyRhr9x4OGb00d2FWb CXw5RVOXvkERu0tfzzKLrnZ+X7FrznJyhDQn/s8QGosFWFIRo+kLGs7GWbHFIjdAMgLB NQAlSXqcKHCFtXtejvMRCiDqRrKOWwpo8psInH7PRdUND3pyZmZhDaqF0FOZBd/WHLWO lMRJMxNf9lU3TyWtptsmIB/4TSg4RTSG+4FH2JL5Y+IUJsJTE558axpKD81Jrr0wo7nj udcQcGEWCbjgwNe3aebN5agxqwOjK0svcUp1Sc5MtIvwL2yIyj5VDOcVEpiMo79J7N9P 5q+Q== 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=lpDy/FCM+s1wbdf3TeRDRBRE0cuHqNCdmWB8qqRhEgo=; b=YNY3gzfonWdcE79H/wPytvrbvpqNtn5KdGpRNHN1xGAaV9bKABfxscIeKx8T80WVvz RguN13sXUoooNGhq11R6ClRk/w5JkhkRWZ2JVSASrcl7WgwguMXzWVi6oo0uLZOGUMCP 72Ks/jZDMpQIky+Raqa+B4U+kfTdiEn77eUMsgbak0Q3aKTjY38DcLKvkC3rYOVo9nbU U8Ta93n4kFAUA8Ojd6CBqmlmszwh9/6sGOBOGDpEIPMvTcL9TYRgVqVkRfOP9nF6TC2A DemlljAW4M2bN2ah5vwNRyw8MgyTsU+iniYfinaCBI/cNV0emae5nUNIOECOiWxicRu5 3i4g== X-Gm-Message-State: ALoCoQkKK+PnHHb1tuLbRi6jsnh5nM3wGjz0Ylozz/StCKkhBTTfErZxSsS2MZPR0o2woJmZOjWp+k7D197tnwcgWFYgE1CTFg== X-Received: by 10.98.12.205 with SMTP id 74mr7856720pfm.53.1449609447724; Tue, 08 Dec 2015 13:17:27 -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.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 08 Dec 2015 13:17:26 -0800 (PST) From: Michael Wood To: toaster@yoctoproject.org Date: Tue, 8 Dec 2015 21:16:06 +0000 Message-Id: <1449609380-11073-21-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 20/34] toaster: toastergui tests Update to reflect changes to CustomImageRecipe 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:17:55 -0000 Now that CustomImageRecipe inherits from Recipe make sure that the accessors and the required values for Recipe are now setup correctly. Signed-off-by: Michael Wood --- bitbake/lib/toaster/toastergui/tests.py | 41 +++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/bitbake/lib/toaster/toastergui/tests.py b/bitbake/lib/toaster/toastergui/tests.py index c927fe1..f31be81 100644 --- a/bitbake/lib/toaster/toastergui/tests.py +++ b/bitbake/lib/toaster/toastergui/tests.py @@ -115,10 +115,16 @@ class ViewTests(TestCase): ProjectLayer.objects.create(project=self.project, layercommit=self.lver) + lver_custom = Layer_Version.objects.create(layer=layer, + project=self.project, + layer_source=layersrc, + commit="mymaster", + up_branch=branch) self.customr = CustomImageRecipe.objects.create(\ name="custom recipe", project=self.project, - base_recipe=self.recipe1) + base_recipe=self.recipe1, + layer_version=lver_custom) CustomImageRecipe.objects.create(name="z custom recipe", project=self.project, @@ -349,7 +355,9 @@ class ViewTests(TestCase): name = "to be deleted" recipe = CustomImageRecipe.objects.create(\ name=name, project=self.project, - base_recipe=self.recipe1) + base_recipe=self.recipe1, + file_path="/tmp/testing", + layer_version=self.customr.layer_version) url = reverse('xhr_customrecipe_id', args=(recipe.id,)) response = self.client.delete(url) self.assertEqual(response.status_code, 200) @@ -362,20 +370,28 @@ class ViewTests(TestCase): def test_xhr_custom_packages(self): """Test adding and deleting package to a custom recipe""" - url = reverse('xhr_customrecipe_packages', - args=(self.customr.id, self.package.id)) - # add self.package1 to recipe - response = self.client.put(url) + # add self.package to recipe + response = self.client.put(reverse('xhr_customrecipe_packages', + args=(self.customr.id, + self.package.id))) + self.assertEqual(response.status_code, 200) - self.assertEqual(json.loads(response.content), {"error": "ok"}) - self.assertEqual(self.customr.packages.all()[0].id, self.package.id) + self.assertEqual(json.loads(response.content), + {"error": "ok", + "dependencies_needed": []}) + self.assertEqual(self.customr.package_set.first().name, + self.package.name) # delete it - response = self.client.delete(url) + del_url = reverse('xhr_customrecipe_packages', + args=(self.customr.id, + self.customr.package_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.packages.all()) + self.assertFalse(self.customr.package_set.all()) # delete it again to test error condition - response = self.client.delete(url) + response = self.client.delete(del_url) self.assertEqual(response.status_code, 200) self.assertNotEqual(json.loads(response.content)["error"], "ok") @@ -403,7 +419,8 @@ class ViewTests(TestCase): row2 = next(x for x in rows if x['name'] == self.recipe2.name) self.assertEqual(response.status_code, 200, 'should be 200 OK status') - self.assertTrue(row2, 'should be 2 recipes') + # self.recipe1 + self.recipe2 + self.customr = 3 + self.assertEqual(len(rows), 3, 'should be 3 recipes') # check other columns have been populated correctly self.assertEqual(row1['name'], self.recipe1.name) -- 2.1.4