diff options
author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2015-10-02 11:05:16 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-10-12 14:38:56 +0100 |
commit | 6aeaca1c83ec43369c3449f3d0cb6fe280bc1120 (patch) | |
tree | 5028e0f78c5708980a8b57330326966b14455d62 | |
parent | 0fb6be01feac7e4d63cb3696bf2d182b3e85bbca (diff) | |
download | poky-6aeaca1c83ec43369c3449f3d0cb6fe280bc1120.tar.gz |
bitbake: toaster: test get_alldeps API
Added test case to test Layer_Version.get_alldeps API.
(Bitbake rev: 159aa333c2f6344b5b37911c3f09601b9f0df6d8)
Signed-off-by: Ed Bartosh <ed.bartosh@linux.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/orm/tests.py | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/bitbake/lib/toaster/orm/tests.py b/bitbake/lib/toaster/orm/tests.py index c30f99a3af..719266e6d6 100644 --- a/bitbake/lib/toaster/orm/tests.py +++ b/bitbake/lib/toaster/orm/tests.py | |||
@@ -23,7 +23,7 @@ | |||
23 | 23 | ||
24 | from django.test import TestCase, TransactionTestCase | 24 | from django.test import TestCase, TransactionTestCase |
25 | from orm.models import LocalLayerSource, LayerIndexLayerSource, ImportedLayerSource, LayerSource | 25 | from orm.models import LocalLayerSource, LayerIndexLayerSource, ImportedLayerSource, LayerSource |
26 | from orm.models import Branch | 26 | from orm.models import Branch, LayerVersionDependency |
27 | 27 | ||
28 | from orm.models import Project, Layer, Layer_Version, Branch, ProjectLayer | 28 | from orm.models import Project, Layer, Layer_Version, Branch, ProjectLayer |
29 | from orm.models import Release, ReleaseLayerSourcePriority, BitbakeVersion | 29 | from orm.models import Release, ReleaseLayerSourcePriority, BitbakeVersion |
@@ -160,3 +160,21 @@ class LayerVersionEquivalenceTestCase(TestCase): | |||
160 | compat_lv = self.project.get_all_compatible_layer_versions() | 160 | compat_lv = self.project.get_all_compatible_layer_versions() |
161 | self.assertEqual(list(compat_lv), [self.lver, self.lver2]) | 161 | self.assertEqual(list(compat_lv), [self.lver, self.lver2]) |
162 | 162 | ||
163 | def test_layerversion_get_alldeps(self): | ||
164 | """Test Layer_Version.get_alldeps API.""" | ||
165 | lvers = {} | ||
166 | for i in range(10): | ||
167 | name = "layer%d" % i | ||
168 | lvers[name] = Layer_Version.objects.create(layer=Layer.objects.create(name=name), | ||
169 | project=self.project) | ||
170 | if i: | ||
171 | LayerVersionDependency.objects.create(layer_version=lvers["layer%d" % (i - 1)], | ||
172 | depends_on=lvers[name]) | ||
173 | # Check dinamically added deps | ||
174 | self.assertEqual(lvers['layer0'].get_alldeps(self.project.id), | ||
175 | [lvers['layer%d' % n] for n in range(1, i+1)]) | ||
176 | |||
177 | # Check chain of deps created in previous loop | ||
178 | for i in range(10): | ||
179 | self.assertEqual(lvers['layer%d' % i].get_alldeps(self.project.id), | ||
180 | [lvers['layer%d' % n] for n in range(i+1, 10)]) | ||