diff options
author | Michael Wood <michael.g.wood@intel.com> | 2016-12-09 16:52:47 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-12-12 20:44:53 +0000 |
commit | 8eed2641636791574d35a9d3a445ee55c7b2258d (patch) | |
tree | d1d5c2c4c66581bb2d2199f79938f8a4876de554 /bitbake | |
parent | f2b0d43c2f010edc47c6a28f23aa862228ec0c27 (diff) | |
download | poky-8eed2641636791574d35a9d3a445ee55c7b2258d.tar.gz |
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>
Diffstat (limited to 'bitbake')
-rw-r--r-- | 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 c20b3fe0b6..1463077e91 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): | |||
142 | # from each of the urls | 142 | # from each of the urls |
143 | self.assertTrue(results) | 143 | self.assertTrue(results) |
144 | 144 | ||
145 | def test_xhr_import_layer(self): | 145 | def test_xhr_add_layer(self): |
146 | """Test xhr_importlayer API""" | 146 | """Test xhr_add API""" |
147 | # Test for importing an already existing layer | 147 | # Test for importing an already existing layer |
148 | args = {'vcs_url': "git://git.example.com/test", | 148 | api_url = reverse('xhr_layer', args=(self.project.id,)) |
149 | 'name': "base-layer", | 149 | |
150 | 'git_ref': "c12b9596afd236116b25ce26dbe0d793de9dc7ce", | 150 | layer_data = {'vcs_url': "git://git.example.com/test", |
151 | 'project_id': self.project.id, | 151 | 'name': "base-layer", |
152 | 'local_source_dir': "", | 152 | 'git_ref': "c12b9596afd236116b25ce26dbe0d793de9dc7ce", |
153 | 'dir_path': "/path/in/repository"} | 153 | 'project_id': self.project.id, |
154 | response = self.client.post(reverse('xhr_importlayer'), args) | 154 | 'local_source_dir': "", |
155 | 'add_to_project': True, | ||
156 | 'dir_path': "/path/in/repository"} | ||
157 | |||
158 | layer_data_json = json.dumps(layer_data) | ||
159 | |||
160 | response = self.client.put(api_url, layer_data_json) | ||
155 | data = json.loads(response.content.decode('utf-8')) | 161 | data = json.loads(response.content.decode('utf-8')) |
156 | self.assertEqual(response.status_code, 200) | 162 | self.assertEqual(response.status_code, 200) |
157 | self.assertEqual(data["error"], "ok") | 163 | self.assertEqual(data["error"], "ok") |
158 | 164 | ||
159 | # Test to verify import of a layer successful | 165 | self.assertTrue( |
160 | args['name'] = "meta-oe" | 166 | layer_data['name'] in |
161 | response = self.client.post(reverse('xhr_importlayer'), args) | 167 | self.project.get_all_compatible_layer_versions().values_list( |
162 | data = json.loads(response.content.decode('utf-8')) | 168 | 'layer__name', |
163 | self.assertTrue(data["error"], "ok") | 169 | flat=True), |
164 | 170 | "Could not find imported layer in project's all layers list" | |
165 | # Test for html tag in the data | 171 | ) |
166 | args['<'] = "testing html tag" | ||
167 | response = self.client.post(reverse('xhr_importlayer'), args) | ||
168 | data = json.loads(response.content.decode('utf-8')) | ||
169 | self.assertNotEqual(data["error"], "ok") | ||
170 | 172 | ||
171 | # Empty data passed | 173 | # Empty data passed |
172 | args = {} | 174 | response = self.client.put(api_url, "{}") |
173 | response = self.client.post(reverse('xhr_importlayer'), args) | ||
174 | data = json.loads(response.content.decode('utf-8')) | 175 | data = json.loads(response.content.decode('utf-8')) |
175 | self.assertNotEqual(data["error"], "ok") | 176 | self.assertNotEqual(data["error"], "ok") |
176 | 177 | ||