[gnome-continuous-yocto/gnomeostree-3.28-rocko: 3647/8267] bitbake: toaster: tests Update import layer test to use new Layer add api
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-continuous-yocto/gnomeostree-3.28-rocko: 3647/8267] bitbake: toaster: tests Update import layer test to use new Layer add api
- Date: Sun, 17 Dec 2017 00:55:38 +0000 (UTC)
commit 8eed2641636791574d35a9d3a445ee55c7b2258d
Author: Michael Wood <michael g wood intel com>
Date: Fri Dec 9 16:52:47 2016 +0000
bitbake: toaster: tests Update import layer test to use new Layer add api
(Bitbake rev: d4c79cd60c12d329c533add73e88b7184dca6ca3)
Signed-off-by: Michael Wood <michael g wood intel com>
Signed-off-by: Richard Purdie <richard purdie linuxfoundation org>
bitbake/lib/toaster/tests/views/test_views.py | 45 +++++++++++++------------
1 files changed, 23 insertions(+), 22 deletions(-)
---
diff --git a/bitbake/lib/toaster/tests/views/test_views.py b/bitbake/lib/toaster/tests/views/test_views.py
index c20b3fe..1463077 100644
--- a/bitbake/lib/toaster/tests/views/test_views.py
+++ b/bitbake/lib/toaster/tests/views/test_views.py
@@ -142,35 +142,36 @@ class ViewTests(TestCase):
# from each of the urls
self.assertTrue(results)
- def test_xhr_import_layer(self):
- """Test xhr_importlayer API"""
+ def test_xhr_add_layer(self):
+ """Test xhr_add API"""
# Test for importing an already existing layer
- args = {'vcs_url': "git://git.example.com/test",
- 'name': "base-layer",
- 'git_ref': "c12b9596afd236116b25ce26dbe0d793de9dc7ce",
- 'project_id': self.project.id,
- 'local_source_dir': "",
- 'dir_path': "/path/in/repository"}
- response = self.client.post(reverse('xhr_importlayer'), args)
+ api_url = reverse('xhr_layer', args=(self.project.id,))
+
+ layer_data = {'vcs_url': "git://git.example.com/test",
+ 'name': "base-layer",
+ 'git_ref': "c12b9596afd236116b25ce26dbe0d793de9dc7ce",
+ 'project_id': self.project.id,
+ 'local_source_dir': "",
+ 'add_to_project': True,
+ 'dir_path': "/path/in/repository"}
+
+ layer_data_json = json.dumps(layer_data)
+
+ response = self.client.put(api_url, layer_data_json)
data = json.loads(response.content.decode('utf-8'))
self.assertEqual(response.status_code, 200)
self.assertEqual(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.decode('utf-8'))
- 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.decode('utf-8'))
- self.assertNotEqual(data["error"], "ok")
+ self.assertTrue(
+ layer_data['name'] in
+ self.project.get_all_compatible_layer_versions().values_list(
+ 'layer__name',
+ flat=True),
+ "Could not find imported layer in project's all layers list"
+ )
# Empty data passed
- args = {}
- response = self.client.post(reverse('xhr_importlayer'), args)
+ response = self.client.put(api_url, "{}")
data = json.loads(response.content.decode('utf-8'))
self.assertNotEqual(data["error"], "ok")
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]