summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2015-08-10 12:21:26 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-08-17 14:41:41 +0100
commit344ad2e1283134600111e3d5647d0ffba33bec74 (patch)
tree8730e1f43522462fd87739e882465f6f40316629 /bitbake
parent11668e24e7f1c5efc26d355ef9f433b3bc2b49e7 (diff)
downloadpoky-344ad2e1283134600111e3d5647d0ffba33bec74.tar.gz
bitbake: toaster: rewrite test for LayerSource model
Rewritten LayerSourceVerifyInheritanceSaveLoad class from scratch. (Bitbake rev: 34ea4c661ee48e1986fe2375b94e5b1c5c16c8ee) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> 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/orm/tests.py30
1 files changed, 18 insertions, 12 deletions
diff --git a/bitbake/lib/toaster/orm/tests.py b/bitbake/lib/toaster/orm/tests.py
index 8bb5deca74..b0c01db216 100644
--- a/bitbake/lib/toaster/orm/tests.py
+++ b/bitbake/lib/toaster/orm/tests.py
@@ -6,28 +6,34 @@ from orm.models import Project, Build, Layer, Layer_Version, Branch, ProjectLaye
6from orm.models import Release, ReleaseLayerSourcePriority, BitbakeVersion 6from orm.models import Release, ReleaseLayerSourcePriority, BitbakeVersion
7 7
8from django.utils import timezone 8from django.utils import timezone
9from django.db import IntegrityError
9 10
10import os 11import os
11 12
12# set TTS_LAYER_INDEX to the base url to use a different instance of the layer index 13# set TTS_LAYER_INDEX to the base url to use a different instance of the layer index
13 14
14# tests to verify inheritance for the LayerSource proxy-inheritance classes
15class LayerSourceVerifyInheritanceSaveLoad(TestCase): 15class LayerSourceVerifyInheritanceSaveLoad(TestCase):
16 """
17 Tests to verify inheritance for the LayerSource proxy-inheritance classes.
18 """
16 def test_object_creation(self): 19 def test_object_creation(self):
17 lls = LayerSource.objects.create(name = "a1", sourcetype = LayerSource.TYPE_LOCAL, apiurl = "") 20 """Test LayerSource object creation."""
18 lils = LayerSource.objects.create(name = "a2", sourcetype = LayerSource.TYPE_LAYERINDEX, apiurl = "") 21 for name, sourcetype in [("a1", LayerSource.TYPE_LOCAL),
19 imls = LayerSource.objects.create(name = "a3", sourcetype = LayerSource.TYPE_IMPORTED, apiurl = "") 22 ("a2", LayerSource.TYPE_LAYERINDEX),
23 ("a3", LayerSource.TYPE_IMPORTED)]:
24 LayerSource.objects.create(name=name, sourcetype=sourcetype)
20 25
21 self.assertTrue(True in map(lambda x: isinstance(x, LocalLayerSource), LayerSource.objects.all())) 26 objects = LayerSource.objects.all()
22 self.assertTrue(True in map(lambda x: isinstance(x, LayerIndexLayerSource), LayerSource.objects.all())) 27 self.assertTrue(isinstance(objects[0], LocalLayerSource))
23 self.assertTrue(True in map(lambda x: isinstance(x, ImportedLayerSource), LayerSource.objects.all())) 28 self.assertTrue(isinstance(objects[1], LayerIndexLayerSource))
29 self.assertTrue(isinstance(objects[2], ImportedLayerSource))
24 30
25 def test_duplicate_error(self): 31 def test_duplicate_error(self):
26 def duplicate(): 32 """Test creation of duplicate LayerSource objects."""
27 LayerSource.objects.create(name = "a1", sourcetype = LayerSource.TYPE_LOCAL, apiurl = "") 33 stype = LayerSource.TYPE_LOCAL
28 LayerSource.objects.create(name = "a1", sourcetype = LayerSource.TYPE_LOCAL, apiurl = "") 34 LayerSource.objects.create(name="a1", sourcetype=stype)
29 35 with self.assertRaises(IntegrityError):
30 self.assertRaises(Exception, duplicate) 36 LayerSource.objects.create(name="a1", sourcetype=stype)
31 37
32 38
33class LILSUpdateTestCase(TransactionTestCase): 39class LILSUpdateTestCase(TransactionTestCase):