From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id E29BBE00A01; Thu, 6 Aug 2015 07:42:28 -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.6 required=5.0 tests=BAYES_00,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.212.171 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] Received: from mail-wi0-f171.google.com (mail-wi0-f171.google.com [209.85.212.171]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 3E144E009B8 for ; Thu, 6 Aug 2015 07:42:24 -0700 (PDT) Received: by wibxm9 with SMTP id xm9so25612163wib.0 for ; Thu, 06 Aug 2015 07:42:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to:content-type :content-transfer-encoding; bh=5Nlh88gGpewkE3FQtSq0tzPaIWDIKUY3WLJMzvzFaAY=; b=QfxVj1M8Ndp9xXQtAgoPW6ntG3uSJLYG7Um+mTe1ex82AQg5O/xgQYnHrwo88Dxd+d zbdd9Fi+oAr5w7KOq7X92gS5mMNEZ/zoNBtFZCG1V2yVwxVDIDaLmdjeWOVVu4L2lMGk VrE3xxsiQnCRMo54rcD7pTU1tsW+vbMC+yKvOXIH2crJ7z+BL/zF5/TRhC6ssU72vPaS jD+76jsHfjaymWIdmzZkTfZhh7jKdowgAfU0fxQLWeDbXWESW5TDI0rLOq5Xf6XnN5Q/ NspFdoiXCh5QXokCeySr+HGfX/Dd3W0xW39mMS0cLz3InCyI9OAGMyQNhte0pfqQODO8 vnWw== X-Gm-Message-State: ALoCoQkMXjFzGy83XTMpcsN7ZfP+Jc5+mI8JMBzo0Zl8l4qAsqx4g1UkJHf84lJsnp7cW0nugahS X-Received: by 10.180.20.80 with SMTP id l16mr7324537wie.55.1438872144007; Thu, 06 Aug 2015 07:42:24 -0700 (PDT) Received: from [192.168.2.18] ([83.217.123.106]) by smtp.googlemail.com with ESMTPSA id fm8sm3670299wib.9.2015.08.06.07.42.23 for (version=TLSv1/SSLv3 cipher=OTHER); Thu, 06 Aug 2015 07:42:23 -0700 (PDT) Message-ID: <55C3724E.3080203@intel.com> Date: Thu, 06 Aug 2015 15:42:22 +0100 From: Michael Wood User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0 MIME-Version: 1.0 To: toaster@yoctoproject.org References: <1438779447-30786-1-git-send-email-sujith.h@gmail.com> In-Reply-To: <1438779447-30786-1-git-send-email-sujith.h@gmail.com> Subject: Re: [review-request][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: Thu, 06 Aug 2015 14:42:29 -0000 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Couple of comments inline: On 05/08/15 13:57, Sujith H wrote: > 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 | 18 ++++++++++++++++++ > 1 file changed, 18 insertions(+) > > diff --git a/bitbake/lib/toaster/toastergui/tests.py b/bitbake/lib/toaster/toastergui/tests.py > index 77e80fe..c4db145 100644 > --- a/bitbake/lib/toaster/toastergui/tests.py > +++ b/bitbake/lib/toaster/toastergui/tests.py > @@ -75,3 +75,21 @@ class XHRDataTypeAheadTestCase(ProvisionedLayersProjectTestCase): > self.assertTrue(len(data["list"]) > 0) > > self.assertTrue(XHRDataTypeAheadTestCase.LAYER_NAME in map(lambda x: x["name"], data["list"])) > + > + > +class XHRImportLayerTestCase(ProvisionedLayersProjectTestCase): > + > + def setUp(self): > + super(XHRImportLayerTestCase, self).setUp() > + self.assertTrue(self.lv in self.project.compatible_layerversions()) > + > + def test_import(self): > + data = {'vcs_url' : "/home/sujith/MEL/toaster_work/meta-oe" , Could you use a faked vcs_url value, e.g. "git://git.example.com/test" > + 'name' : "base-layer", 'git_ref': "c12b9596afd236116b25ce26dbe0d793de9dc7ce", > + 'project_id': 1, 'dir_path' : "/home/sujith/MEL/toaster_work/meta-oe/meta-oe"} Same with this one, dir_path can be "/path/in/repository" > + result = self.client.post(reverse('xhr_importlayer'), data, HTTP_X_REQUESTED_WITH='XMLHttpRequest') I don't think HTTP_X_REQUESTED_WITH really needs setting, the default should be fine. > + self.assertEqual(result.status_code,200) > + self.assertTrue("hint-layer-exists-with-different-url" in result.content) > + data['name'] = "meta-oe" > + result = self.client.post(reverse('xhr_importlayer'), data, HTTP_X_REQUESTED_WITH='XMLHttpRequest') > + self.assertTrue('"error": "ok"' in result.content) Some new lines between the logical parts in the test would be good. It would be great to cover these two conditions as well: {"error": "Missing parameters; requires vcs_url, name, git_ref and project_id"} {"error": "Invalid character <"} Thanks, Michael