Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id CEDD8E00A9C; Tue, 11 Aug 2015 05:19:43 -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) * -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 * -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low * trust * [209.85.192.180 listed in list.dnswl.org] Received: from mail-pd0-f180.google.com (mail-pd0-f180.google.com [209.85.192.180]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 3E6D7E00A92 for ; Tue, 11 Aug 2015 05:19:40 -0700 (PDT) Received: by pdco4 with SMTP id o4so83274771pdc.3 for ; Tue, 11 Aug 2015 05:19:40 -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=5HJLVGjKK92WorMe+rDbN387z4ZPijweEulpzEQDgZI=; b=qPBpKe8sdH5nuym4i3tI4IjEodR6Ve4AtpjiS3iYLh/+G0I6e/f/JKwx+h0qJufxaH jo4wwuixiULq+0WqVLwNt1YSxwJJz8nmtkW99kKoVMc0vqcLSb9quMf6Zm72sCN9zvHR 4t1OE24vkKVsqQZb8WMvhZ8VSfxjGlSa548wai6NkCDe+HVKIrKH6/fNZ9Zi5jYFdil2 yaXP7X6uiEg7tEx1m/hONTn6uAqRxUqQiwqh3uYdb87Z9Ue8GUHty4yEn/5gJCEcYfZH KO67RnVAGxkeZ1/fdmJ5kJQSMhHUJ6kcd8pWIR0Y/gOY/O5Iiy2J6UIIrS/IJ9gaXbx/ flCA== X-Received: by 10.70.98.163 with SMTP id ej3mr48319076pdb.61.1439295580061; Tue, 11 Aug 2015 05:19:40 -0700 (PDT) Received: from kdekidd0.inp.mentorg.com ([139.181.35.34]) by smtp.gmail.com with ESMTPSA id pi4sm2496757pdb.60.2015.08.11.05.19.37 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 11 Aug 2015 05:19:39 -0700 (PDT) From: Sujith H To: toaster@yoctoproject.org Date: Tue, 11 Aug 2015 17:49:24 +0530 Message-Id: <1439295564-16012-1-git-send-email-sujith.h@gmail.com> X-Mailer: git-send-email 1.9.1 Subject: [PATCH] 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 12:19:43 -0000 From: Sujith Haridasan 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..6febb7b 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.assertEqual(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