Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 5B94DE00BB5; Tue, 8 Dec 2015 13:17:56 -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.170 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-f170.google.com (mail-pf0-f170.google.com [209.85.192.170]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 2E3E7E00B97 for ; Tue, 8 Dec 2015 13:17:30 -0800 (PST) Received: by pfdd184 with SMTP id d184so17922418pfd.3 for ; Tue, 08 Dec 2015 13:17:30 -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=mcMM7nrSYitvSTHjOqQxS4x0y2R7l5HJRvIX+JG1Q4U=; b=AATbTjw0NjLoKf1TRjVxNQKCAqCuvQIMMQd4TCbw1GB0i3mySZPih9rqv6hAVwNWo0 mipy8orvYQbrX37f0fORjKbe4TKu36x6z2zIA38IznBZsLC6UYndtuyNnMu8gYRuzg5a U3c//DCmgZ5n7095Ly2u7x8flMTaO0OoolDqhz3j/DDQQwxIBvUVb5m9/d76C9e5s0ys 7pfLW7W9zhpT/s2kB4hWbwuRCQrQObOjxDZ2sht3QglK5h87AbpWVL1NBnVhJuuNU8N/ zuvsxnRzEJErhoAnsq8ph0qp+4yLl1/aWTcvDn6nVNMeKmVieBqs4ukUpw3jgHQgWs4g tD4g== 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=mcMM7nrSYitvSTHjOqQxS4x0y2R7l5HJRvIX+JG1Q4U=; b=QsYuZU/R0XpgDmR8EL8AQVdGQtbdAICblZ5LZkiiNbpgdojmPeR0/t+iS8Bzg5mQrB QV5XguAuXsE/+u5l9hAV9rlx/iRKYyUntMjGLCpfOBtL3oH3PZ+mxwNPQgBclbMpTm3Q f6ARJ342BDO/rJceWZCjfyt9blg+J+HbH4R4awTdqaAMkasCq9all+NqGuD7hYjzspLZ xa1+IDx2e3038OcFb3cjGc0vmCfH1Q0sp8qbfEegTWM9tN4J6cX3HR/qm3yzJ943y6pP nKMg4+w4krsDY94DmLe5oVj8UKjTQAPKwfJauR2AMHL6hg1QurCvS+qJhFfBjNdWqJZQ SIkA== X-Gm-Message-State: ALoCoQkXJb4s/y6ejUxdRAe022OYiDk8y/aVtDs515h7wnzeWuWZ3m2GLh0O6hA7o1ICf2zacFscGLLFIT3CWzFJ97APNNGIHA== X-Received: by 10.98.87.16 with SMTP id l16mr7965548pfb.80.1449609450316; Tue, 08 Dec 2015 13:17:30 -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.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 08 Dec 2015 13:17:29 -0800 (PST) From: Michael Wood To: toaster@yoctoproject.org Date: Tue, 8 Dec 2015 21:16:07 +0000 Message-Id: <1449609380-11073-22-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 21/34] toaster: toastergui tests Add unit test for download custom recipe 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:56 -0000 Add unit test to test downloading end point and the basic content of the custom recipe that is generated. Signed-off-by: Michael Wood --- bitbake/lib/toaster/toastergui/tests.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/bitbake/lib/toaster/toastergui/tests.py b/bitbake/lib/toaster/toastergui/tests.py index f31be81..3683b51 100644 --- a/bitbake/lib/toaster/toastergui/tests.py +++ b/bitbake/lib/toaster/toastergui/tests.py @@ -79,6 +79,7 @@ class ViewTests(TestCase): project=self.project, layer_source=layersrc, commit="master", + dirpath="/tmp/", up_branch=branch) lver_two = Layer_Version.objects.create(layer=layer_two, @@ -95,6 +96,8 @@ class ViewTests(TestCase): section="h section", layer_version=lver_two) + # Create a dummy recipe file for the custom image generation to read + open("/tmp/my_recipe.bb", 'wa').close() self.recipe1 = Recipe.objects.create(layer_source=layersrc, name="base-recipe", version="1.2", @@ -102,7 +105,8 @@ class ViewTests(TestCase): description="recipe", section="A section", license="Apache", - layer_version=self.lver) + layer_version=self.lver, + file_path="my_recipe.bb") Machine.objects.create(layer_version=self.lver, name="wisk", description="wisking machine") @@ -407,6 +411,14 @@ class ViewTests(TestCase): self.assertNotEqual(json.loads(response.content), {"error": "ok"}) + def test_download_custom_recipe(self): + response = self.client.get(reverse('customrecipedownload', + args=(self.project.id, + self.customr.id))) + + self.assertEqual(response.status_code, 200) + + def test_software_recipes_table(self): """Test structure returned for Software RecipesTable""" table = SoftwareRecipesTable() -- 2.1.4