diff options
author | Michael Wood <michael.g.wood@intel.com> | 2015-12-08 16:07:02 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-02-10 13:29:19 +0000 |
commit | 7e4c231ca2a1a2dbc905945ba8bab0476c109bbb (patch) | |
tree | 347e65adb7de094d98089978f8364f78eea548b5 | |
parent | 4b3c9d61dc0c416d4d277de680604e2f6697e288 (diff) | |
download | poky-7e4c231ca2a1a2dbc905945ba8bab0476c109bbb.tar.gz |
bitbake: toaster: toastergui tests Update package test to use CustomImagePackage
Update test for adding and removing a package from a CustomImageRecipe
so that it uses the CustomImagePackage and correct fields for the packages
included. Change the test for error condition to use an invalid package
id as ManyToMany remove() on package that isn't in the relationship does
not throw an error.
(Bitbake rev: daccb2978f833a9e7af270160331da3e9a158219)
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>
-rw-r--r-- | bitbake/lib/toaster/toastergui/tests.py | 25 |
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 | |||
30 | from orm.models import ReleaseLayerSourcePriority, LayerSource, Layer, Build | 30 | from orm.models import ReleaseLayerSourcePriority, LayerSource, Layer, Build |
31 | from orm.models import Layer_Version, Recipe, Machine, ProjectLayer, Target | 31 | from orm.models import Layer_Version, Recipe, Machine, ProjectLayer, Target |
32 | from orm.models import CustomImageRecipe, ProjectVariable | 32 | from orm.models import CustomImageRecipe, ProjectVariable |
33 | from orm.models import Branch | 33 | from orm.models import Branch, CustomImagePackage |
34 | 34 | ||
35 | import toastermain | 35 | import toastermain |
36 | import inspect | 36 | import 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") |