Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 641D6E00A90; Tue, 11 Aug 2015 00:29:59 -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.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-HAM-Report: * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider * (sujith.h[at]gmail.com) * -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_VALID_AU Message has a valid DKIM or DK signature from author's * domain * 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-pd0-f170.google.com (mail-pd0-f170.google.com [209.85.192.170]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 8BB73E00A3B for ; Tue, 11 Aug 2015 00:29:56 -0700 (PDT) Received: by pdrg1 with SMTP id g1so80662176pdr.2 for ; Tue, 11 Aug 2015 00:29:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=99MszLYJXvBJYhWsn6Yw6QyP8kp9K0U713WbLXSRqlE=; b=Qp44nvtX/JxKYQmUvGImH6VCNwOLTN7hog+QJchoNBO4A10lggp5B5C0juttnIXKUr ZNtE4+2g8yxAUPa4G3foA0ynKopa475pi3tFeVk9gNRPeQgq++DuECswE9biZKF3E9wr kKDH3wJC10TxXMEFjU3tRtJtts2uM8PeKBwXuSMVE3XhUJivEH/aseP54ylppmLL9rgC DgGQ+Dx2uo8XAzHaFEQg7xQvMxvY9CA5H30i2ZWO/YBcBxTnSq8ydxTztaVfQrhIdUuy ueZsmP0ECLZDQx1FN1AXe6IekbdQtNJqhKiT7zPEnM032yw4qM4zOCRqvSjotshH0XVa HK4w== X-Received: by 10.70.41.100 with SMTP id e4mr53574473pdl.169.1439278195675; Tue, 11 Aug 2015 00:29:55 -0700 (PDT) Received: from kdekidd0.inp.mentorg.com ([139.181.35.34]) by smtp.gmail.com with ESMTPSA id ud2sm1380298pbc.57.2015.08.11.00.29.53 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 11 Aug 2015 00:29:54 -0700 (PDT) From: Sujith H To: toaster@yoctoproject.org Date: Tue, 11 Aug 2015 12:59:46 +0530 Message-Id: <1439278186-6357-1-git-send-email-sujith.h@gmail.com> X-Mailer: git-send-email 1.9.1 Subject: [review-request][PATCH][v3] toastergui: Add tests for xhr_importlayer 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, 11 Aug 2015 07:29:59 -0000 Inorder to make sure if layer name which we import is already available in toaster database, a test case has been included. This would help user to identify if layer name which has been provided in the import layer web page already exists or not. Signed-off-by: Sujith Haridasan Signed-off-by: Sujith Haridasan --- bitbake/lib/toaster/toastergui/tests.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/bitbake/lib/toaster/toastergui/tests.py b/bitbake/lib/toaster/toastergui/tests.py index 93a85ac..85e27fe 100644 --- a/bitbake/lib/toaster/toastergui/tests.py +++ b/bitbake/lib/toaster/toastergui/tests.py @@ -148,3 +148,33 @@ class ViewTests(TestCase): # After "typeing" the alpabet we should have result true # from each of the urls self.assertTrue(results) + + def test_xhr_import_layer(self): + """Test xhr_importlayer API""" + #Test for importing an already existing layer + args = {'vcs_url' : "git://git.example.com/test", + 'name' : "base-layer", + 'git_ref': "c12b9596afd236116b25ce26dbe0d793de9dc7ce", + 'project_id': 1, 'dir_path' : "/path/in/repository"} + response = self.client.post(reverse('xhr_importlayer'), args) + data = json.loads(response.content) + self.assertEqual(response.status_code, 200) + self.assertNotEqual(data["error"], "ok") + + #Test to verify import of a layer successful + args['name'] = "meta-oe" + response = self.client.post(reverse('xhr_importlayer'), args) + data = json.loads(response.content) + self.assertTrue(data["error"], "ok") + + #Test for html tag in the data + args['<'] = "testing html tag" + response = self.client.post(reverse('xhr_importlayer'), args) + data = json.loads(response.content) + self.assertNotEqual(data["error"], "ok") + + #Empty data passed + args = {} + response = self.client.post(reverse('xhr_importlayer'), args) + data = json.loads(response.content) + self.assertNotEqual(data["error"], "ok") -- 1.9.1