From 234226b9055a3b23addcdaa7a77812dc7aa79134 Mon Sep 17 00:00:00 2001 From: Alexandru DAMIAN Date: Fri, 8 Aug 2014 15:03:03 +0100 Subject: 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 Signed-off-by: Richard Purdie --- bitbake/lib/toaster/orm/tests.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 bitbake/lib/toaster/orm/tests.py (limited to 'bitbake/lib/toaster/orm/tests.py') 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 @@ +from django.test import TestCase +from orm.models import LocalLayerSource, LayerIndexLayerSource, LayerSource +from orm.models import Branch + +class LayerSourceVerifyInheritanceSaveLoad(TestCase): + def test_object_creation(self): + lls = LayerSource.objects.create(name = "a1", sourcetype = LayerSource.TYPE_LOCAL, apiurl = "") + lils = LayerSource.objects.create(name = "a1", sourcetype = LayerSource.TYPE_LAYERINDEX, apiurl = "") + + print LayerSource.objects.all() + + self.assertTrue(True in map(lambda x: isinstance(x, LocalLayerSource), LayerSource.objects.all())) + self.assertTrue(True in map(lambda x: isinstance(x, LayerIndexLayerSource), LayerSource.objects.all())) + + def test_duplicate_error(self): + def duplicate(): + LayerSource.objects.create(name = "a1", sourcetype = LayerSource.TYPE_LOCAL, apiurl = "") + LayerSource.objects.create(name = "a1", sourcetype = LayerSource.TYPE_LOCAL, apiurl = "") + + self.assertRaises(Exception, duplicate) + + + +class LILSUpdateTestCase(TestCase): + def test_update(self): + lils = LayerSource.objects.create(name = "b1", sourcetype = LayerSource.TYPE_LAYERINDEX, apiurl = "http://adamian-desk.local:8080/layerindex/api/") + lils.update() + + # run second update + # lils.update() + + # print vars(lils) + #print map(lambda x: vars(x), Branch.objects.all()) -- cgit v1.2.3-54-g00ecf