All of lore.kernel.org
 help / color / mirror / Atom feed
* [review-request][PATCH][v3] toastergui: Add tests for xhr_importlayer
@ 2015-08-11  7:29 Sujith H
  2015-08-12 11:17 ` Michael Wood
  0 siblings, 1 reply; 3+ messages in thread
From: Sujith H @ 2015-08-11  7:29 UTC (permalink / raw)
  To: toaster

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 <sujith.h@gmail.com>
Signed-off-by: Sujith Haridasan <Sujith_Haridasan@mentor.com>
---
 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



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [review-request][PATCH][v3] toastergui: Add tests for xhr_importlayer
  2015-08-11  7:29 [review-request][PATCH][v3] toastergui: Add tests for xhr_importlayer Sujith H
@ 2015-08-12 11:17 ` Michael Wood
  2015-08-12 11:30   ` sujith h
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Wood @ 2015-08-12 11:17 UTC (permalink / raw)
  To: toaster

Thanks Sujith, patch submitted to bitbake.

On 11/08/15 08:29, 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 <sujith.h@gmail.com>
> Signed-off-by: Sujith Haridasan <Sujith_Haridasan@mentor.com>
> ---
>   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")



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [review-request][PATCH][v3] toastergui: Add tests for xhr_importlayer
  2015-08-12 11:17 ` Michael Wood
@ 2015-08-12 11:30   ` sujith h
  0 siblings, 0 replies; 3+ messages in thread
From: sujith h @ 2015-08-12 11:30 UTC (permalink / raw)
  To: Michael Wood; +Cc: toaster

[-- Attachment #1: Type: text/plain, Size: 2980 bytes --]

On Wed, Aug 12, 2015 at 4:47 PM, Michael Wood <michael.g.wood@intel.com>
wrote:

> Thanks Sujith, patch submitted to bitbake.


Thank you Michael and Ed for great help :)

>
>
> On 11/08/15 08:29, 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 <sujith.h@gmail.com>
>> Signed-off-by: Sujith Haridasan <Sujith_Haridasan@mentor.com>
>> ---
>>   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")
>>
>
> --
> _______________________________________________
> toaster mailing list
> toaster@yoctoproject.org
> https://lists.yoctoproject.org/listinfo/toaster
>



-- 
സുജിത് ഹരിദാസന്
Bangalore
<Project>Contributor to KDE project
http://fci.wikia.com/wiki/Anti-DRM-Campaign
<Blog> http://sujithh.info

[-- Attachment #2: Type: text/html, Size: 4595 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-08-12 11:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-11  7:29 [review-request][PATCH][v3] toastergui: Add tests for xhr_importlayer Sujith H
2015-08-12 11:17 ` Michael Wood
2015-08-12 11:30   ` sujith h

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.