summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorMichael Wood <michael.g.wood@intel.com>2015-11-05 12:33:35 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-02-10 13:29:18 +0000
commit04d8c9456465d1d7c9e6e0c7e9768714051f0b25 (patch)
tree4ec8910392fbff8545bcbd147a5a24a64d58680e /bitbake
parent4e8a0aa66e15de24895b2c662b80504843f72107 (diff)
downloadpoky-04d8c9456465d1d7c9e6e0c7e9768714051f0b25.tar.gz
bitbake: toaster: toastergui tests Update to reflect changes to CustomImageRecipe
Now that CustomImageRecipe inherits from Recipe make sure that the accessors and the required values for Recipe are now setup correctly. (Bitbake rev: e958921e15a3c3e5a6b7c27ebe37fdf1f551f198) Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: brian avery <avery.brian@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/toaster/toastergui/tests.py41
1 files changed, 29 insertions, 12 deletions
diff --git a/bitbake/lib/toaster/toastergui/tests.py b/bitbake/lib/toaster/toastergui/tests.py
index 0987721180..0c7829c2b3 100644
--- a/bitbake/lib/toaster/toastergui/tests.py
+++ b/bitbake/lib/toaster/toastergui/tests.py
@@ -150,10 +150,16 @@ class ViewTests(TestCase):
150 150
151 ProjectLayer.objects.create(project=self.project, layercommit=self.lver) 151 ProjectLayer.objects.create(project=self.project, layercommit=self.lver)
152 152
153 lver_custom = Layer_Version.objects.create(layer=layer,
154 project=self.project,
155 layer_source=layersrc,
156 commit="mymaster",
157 up_branch=branch)
153 158
154 self.customr = CustomImageRecipe.objects.create(\ 159 self.customr = CustomImageRecipe.objects.create(\
155 name="custom recipe", project=self.project, 160 name="custom recipe", project=self.project,
156 base_recipe=self.recipe1) 161 base_recipe=self.recipe1,
162 layer_version=lver_custom)
157 163
158 CustomImageRecipe.objects.create(name="z custom recipe", 164 CustomImageRecipe.objects.create(name="z custom recipe",
159 project=self.project, 165 project=self.project,
@@ -376,7 +382,9 @@ class ViewTests(TestCase):
376 name = "to be deleted" 382 name = "to be deleted"
377 recipe = CustomImageRecipe.objects.create(\ 383 recipe = CustomImageRecipe.objects.create(\
378 name=name, project=self.project, 384 name=name, project=self.project,
379 base_recipe=self.recipe1) 385 base_recipe=self.recipe1,
386 file_path="/tmp/testing",
387 layer_version=self.customr.layer_version)
380 url = reverse('xhr_customrecipe_id', args=(recipe.id,)) 388 url = reverse('xhr_customrecipe_id', args=(recipe.id,))
381 response = self.client.delete(url) 389 response = self.client.delete(url)
382 self.assertEqual(response.status_code, 200) 390 self.assertEqual(response.status_code, 200)
@@ -389,20 +397,28 @@ class ViewTests(TestCase):
389 397
390 def test_xhr_custom_packages(self): 398 def test_xhr_custom_packages(self):
391 """Test adding and deleting package to a custom recipe""" 399 """Test adding and deleting package to a custom recipe"""
392 url = reverse('xhr_customrecipe_packages', 400 # add self.package to recipe
393 args=(self.customr.id, self.package.id)) 401 response = self.client.put(reverse('xhr_customrecipe_packages',
394 # add self.package1 to recipe 402 args=(self.customr.id,
395 response = self.client.put(url) 403 self.package.id)))
404
396 self.assertEqual(response.status_code, 200) 405 self.assertEqual(response.status_code, 200)
397 self.assertEqual(json.loads(response.content), {"error": "ok"}) 406 self.assertEqual(json.loads(response.content),
398 self.assertEqual(self.customr.packages.all()[0].id, self.package.id) 407 {"error": "ok",
408 "dependencies_needed": []})
409 self.assertEqual(self.customr.package_set.first().name,
410 self.package.name)
399 # delete it 411 # delete it
400 response = self.client.delete(url) 412 del_url = reverse('xhr_customrecipe_packages',
413 args=(self.customr.id,
414 self.customr.package_set.first().id))
415
416 response = self.client.delete(del_url)
401 self.assertEqual(response.status_code, 200) 417 self.assertEqual(response.status_code, 200)
402 self.assertEqual(json.loads(response.content), {"error": "ok"}) 418 self.assertEqual(json.loads(response.content), {"error": "ok"})
403 self.assertFalse(self.customr.packages.all()) 419 self.assertFalse(self.customr.package_set.all())
404 # delete it again to test error condition 420 # delete it again to test error condition
405 response = self.client.delete(url) 421 response = self.client.delete(del_url)
406 self.assertEqual(response.status_code, 200) 422 self.assertEqual(response.status_code, 200)
407 self.assertNotEqual(json.loads(response.content)["error"], "ok") 423 self.assertNotEqual(json.loads(response.content)["error"], "ok")
408 424
@@ -430,7 +446,8 @@ class ViewTests(TestCase):
430 row2 = next(x for x in rows if x['name'] == self.recipe2.name) 446 row2 = next(x for x in rows if x['name'] == self.recipe2.name)
431 447
432 self.assertEqual(response.status_code, 200, 'should be 200 OK status') 448 self.assertEqual(response.status_code, 200, 'should be 200 OK status')
433 self.assertTrue(row2, 'should be 2 recipes') 449 # self.recipe1 + self.recipe2 + self.customr = 3
450 self.assertEqual(len(rows), 3, 'should be 3 recipes')
434 451
435 # check other columns have been populated correctly 452 # check other columns have been populated correctly
436 self.assertEqual(row1['name'], self.recipe1.name) 453 self.assertEqual(row1['name'], self.recipe1.name)