diff options
author | Sujith H <sujith.h@gmail.com> | 2015-08-12 12:15:11 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-08-17 08:48:28 +0100 |
commit | 91d8f88bb77e37cb3b4de0c7cf280cbb746e6c4b (patch) | |
tree | 358db1a88a0067c47da2d8badd9ab5fd10d9b9af /bitbake/lib | |
parent | c9d1cb299ac67aa71653f1f8d978b2b07b790965 (diff) | |
download | poky-91d8f88bb77e37cb3b4de0c7cf280cbb746e6c4b.tar.gz |
bitbake: toastergui: Add tests for xhr_importlayer
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.
(Bitbake rev: 26e2b4a997503b82dc5535ce087565a0d6418141)
Signed-off-by: Sujith Haridasan <sujith.h@gmail.com>
Signed-off-by: Sujith Haridasan <Sujith_Haridasan@mentor.com>
Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r-- | bitbake/lib/toaster/toastergui/tests.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/toastergui/tests.py b/bitbake/lib/toaster/toastergui/tests.py index 93a85ac7a9..85e27fe07c 100644 --- a/bitbake/lib/toaster/toastergui/tests.py +++ b/bitbake/lib/toaster/toastergui/tests.py | |||
@@ -148,3 +148,33 @@ class ViewTests(TestCase): | |||
148 | # After "typeing" the alpabet we should have result true | 148 | # After "typeing" the alpabet we should have result true |
149 | # from each of the urls | 149 | # from each of the urls |
150 | self.assertTrue(results) | 150 | self.assertTrue(results) |
151 | |||
152 | def test_xhr_import_layer(self): | ||
153 | """Test xhr_importlayer API""" | ||
154 | #Test for importing an already existing layer | ||
155 | args = {'vcs_url' : "git://git.example.com/test", | ||
156 | 'name' : "base-layer", | ||
157 | 'git_ref': "c12b9596afd236116b25ce26dbe0d793de9dc7ce", | ||
158 | 'project_id': 1, 'dir_path' : "/path/in/repository"} | ||
159 | response = self.client.post(reverse('xhr_importlayer'), args) | ||
160 | data = json.loads(response.content) | ||
161 | self.assertEqual(response.status_code, 200) | ||
162 | self.assertNotEqual(data["error"], "ok") | ||
163 | |||
164 | #Test to verify import of a layer successful | ||
165 | args['name'] = "meta-oe" | ||
166 | response = self.client.post(reverse('xhr_importlayer'), args) | ||
167 | data = json.loads(response.content) | ||
168 | self.assertTrue(data["error"], "ok") | ||
169 | |||
170 | #Test for html tag in the data | ||
171 | args['<'] = "testing html tag" | ||
172 | response = self.client.post(reverse('xhr_importlayer'), args) | ||
173 | data = json.loads(response.content) | ||
174 | self.assertNotEqual(data["error"], "ok") | ||
175 | |||
176 | #Empty data passed | ||
177 | args = {} | ||
178 | response = self.client.post(reverse('xhr_importlayer'), args) | ||
179 | data = json.loads(response.content) | ||
180 | self.assertNotEqual(data["error"], "ok") | ||