summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/orm/tests.py
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2014-08-08 15:03:03 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-08-29 13:56:49 +0100
commit234226b9055a3b23addcdaa7a77812dc7aa79134 (patch)
tree979683201cb4f16cc9937aa30dadcf492edb442a /bitbake/lib/toaster/orm/tests.py
parent10019a652f2894f8782cc9281c980edad701822a (diff)
downloadpoky-234226b9055a3b23addcdaa7a77812dc7aa79134.tar.gz
bitbake: toaster: update orm models for layerindex compatibility
We add a ToasterSettings table that will keep installation-wide settings. We update the models for the layer-related data storage to make them compatible with the layerindex application API. We add a LayerSource class that can update local data from a LayerIndex-like compatible API. Adding a command line option to perform information update from all upstream layer sources. Fair warning - there is no backward migration from 0013. (Bitbake rev: 89e13579e1b44b738f10fadec8454aa0e6f073af) Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/orm/tests.py')
-rw-r--r--bitbake/lib/toaster/orm/tests.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/orm/tests.py b/bitbake/lib/toaster/orm/tests.py
new file mode 100644
index 0000000000..f2f561bff9
--- /dev/null
+++ b/bitbake/lib/toaster/orm/tests.py
@@ -0,0 +1,33 @@
1from django.test import TestCase
2from orm.models import LocalLayerSource, LayerIndexLayerSource, LayerSource
3from orm.models import Branch
4
5class LayerSourceVerifyInheritanceSaveLoad(TestCase):
6 def test_object_creation(self):
7 lls = LayerSource.objects.create(name = "a1", sourcetype = LayerSource.TYPE_LOCAL, apiurl = "")
8 lils = LayerSource.objects.create(name = "a1", sourcetype = LayerSource.TYPE_LAYERINDEX, apiurl = "")
9
10 print LayerSource.objects.all()
11
12 self.assertTrue(True in map(lambda x: isinstance(x, LocalLayerSource), LayerSource.objects.all()))
13 self.assertTrue(True in map(lambda x: isinstance(x, LayerIndexLayerSource), LayerSource.objects.all()))
14
15 def test_duplicate_error(self):
16 def duplicate():
17 LayerSource.objects.create(name = "a1", sourcetype = LayerSource.TYPE_LOCAL, apiurl = "")
18 LayerSource.objects.create(name = "a1", sourcetype = LayerSource.TYPE_LOCAL, apiurl = "")
19
20 self.assertRaises(Exception, duplicate)
21
22
23
24class LILSUpdateTestCase(TestCase):
25 def test_update(self):
26 lils = LayerSource.objects.create(name = "b1", sourcetype = LayerSource.TYPE_LAYERINDEX, apiurl = "http://adamian-desk.local:8080/layerindex/api/")
27 lils.update()
28
29 # run second update
30 # lils.update()
31
32 # print vars(lils)
33 #print map(lambda x: vars(x), Branch.objects.all())