summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/toastergui/tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/toaster/toastergui/tests.py')
-rw-r--r--bitbake/lib/toaster/toastergui/tests.py25
1 files changed, 16 insertions, 9 deletions
diff --git a/bitbake/lib/toaster/toastergui/tests.py b/bitbake/lib/toaster/toastergui/tests.py
index d85498d099..bd5cb0f244 100644
--- a/bitbake/lib/toaster/toastergui/tests.py
+++ b/bitbake/lib/toaster/toastergui/tests.py
@@ -30,7 +30,7 @@ from orm.models import Project, Release, BitbakeVersion, Package, LogMessage
30from orm.models import ReleaseLayerSourcePriority, LayerSource, Layer, Build 30from orm.models import ReleaseLayerSourcePriority, LayerSource, Layer, Build
31from orm.models import Layer_Version, Recipe, Machine, ProjectLayer, Target 31from orm.models import Layer_Version, Recipe, Machine, ProjectLayer, Target
32from orm.models import CustomImageRecipe, ProjectVariable 32from orm.models import CustomImageRecipe, ProjectVariable
33from orm.models import Branch 33from orm.models import Branch, CustomImagePackage
34 34
35import toastermain 35import toastermain
36import inspect 36import inspect
@@ -176,6 +176,10 @@ class ViewTests(TestCase):
176 176
177 Package.objects.create(name='zpkg1', recipe=self.recipe1, build=build) 177 Package.objects.create(name='zpkg1', recipe=self.recipe1, build=build)
178 178
179 self.cust_package = CustomImagePackage.objects.create(
180 name="ppkg1",
181 recipe=self.recipe1)
182
179 # recipe with project for testing AvailableRecipe table 183 # recipe with project for testing AvailableRecipe table
180 self.recipe2 = Recipe.objects.create(layer_source=layersrc, 184 self.recipe2 = Recipe.objects.create(layer_source=layersrc,
181 name="fancy-recipe", 185 name="fancy-recipe",
@@ -404,24 +408,27 @@ class ViewTests(TestCase):
404 # add self.package to recipe 408 # add self.package to recipe
405 response = self.client.put(reverse('xhr_customrecipe_packages', 409 response = self.client.put(reverse('xhr_customrecipe_packages',
406 args=(self.customr.id, 410 args=(self.customr.id,
407 self.package.id))) 411 self.cust_package.id)))
408 412
409 self.assertEqual(response.status_code, 200) 413 self.assertEqual(response.status_code, 200)
410 self.assertEqual(json.loads(response.content), 414 self.assertEqual(json.loads(response.content),
411 {"error": "ok", 415 {"error": "ok"})
412 "dependencies_needed": []}) 416 self.assertEqual(self.customr.appends_set.first().name,
413 self.assertEqual(self.customr.package_set.first().name, 417 self.cust_package.name)
414 self.package.name)
415 # delete it 418 # delete it
416 del_url = reverse('xhr_customrecipe_packages', 419 del_url = reverse('xhr_customrecipe_packages',
417 args=(self.customr.id, 420 args=(self.customr.id,
418 self.customr.package_set.first().id)) 421 self.customr.appends_set.first().id))
419 422
420 response = self.client.delete(del_url) 423 response = self.client.delete(del_url)
421 self.assertEqual(response.status_code, 200) 424 self.assertEqual(response.status_code, 200)
422 self.assertEqual(json.loads(response.content), {"error": "ok"}) 425 self.assertEqual(json.loads(response.content), {"error": "ok"})
423 self.assertFalse(self.customr.package_set.all()) 426 self.assertFalse(self.customr.includes_set.all())
424 # delete it again to test error condition 427 # delete invalid package to test error condition
428 del_url = reverse('xhr_customrecipe_packages',
429 args=(self.customr.id,
430 99999))
431
425 response = self.client.delete(del_url) 432 response = self.client.delete(del_url)
426 self.assertEqual(response.status_code, 200) 433 self.assertEqual(response.status_code, 200)
427 self.assertNotEqual(json.loads(response.content)["error"], "ok") 434 self.assertNotEqual(json.loads(response.content)["error"], "ok")