From d637b91639fcae376b88319b0f38b3f92cd4c723 Mon Sep 17 00:00:00 2001 From: Ed Bartosh Date: Mon, 10 Aug 2015 12:21:27 +0100 Subject: bitbake: toaster: rewrite LILSUpdateTestCase Reformatted code. Added docstings. (Bitbake rev: 0d1a9038b0cface75d3c858543e411f519b4ef5e) Signed-off-by: Ed Bartosh Signed-off-by: Michael Wood Signed-off-by: Richard Purdie --- bitbake/lib/toaster/orm/tests.py | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'bitbake/lib') diff --git a/bitbake/lib/toaster/orm/tests.py b/bitbake/lib/toaster/orm/tests.py index b0c01db216..3384f01c39 100644 --- a/bitbake/lib/toaster/orm/tests.py +++ b/bitbake/lib/toaster/orm/tests.py @@ -37,22 +37,26 @@ class LayerSourceVerifyInheritanceSaveLoad(TestCase): class LILSUpdateTestCase(TransactionTestCase): + """Test Layer Source update.""" + def setUp(self): - # create release - bbv = BitbakeVersion.objects.create(name="master", giturl="git://git.openembedded.org/bitbake") - release = Release.objects.create(name="default-release", bitbake_version = bbv, branch_name = "master") + """Create release.""" + bbv = BitbakeVersion.objects.create(\ + name="master", giturl="git://git.openembedded.org/bitbake") + Release.objects.create(name="default-release", bitbake_version=bbv, + branch_name="master") def test_update(self): - layer_index_url = os.getenv("TTS_LAYER_INDEX") - if layer_index_url == None: - layer_index_url = "http://layers.openembedded.org/" - - lils = LayerSource.objects.create(name = "b1", sourcetype = LayerSource.TYPE_LAYERINDEX, apiurl = layer_index_url + "layerindex/api/") - lils.update() - - # run asserts - self.assertTrue(lils.branch_set.all().count() > 0, "update() needs to fetch some branches") - + """Check if LayerSource.update can fetch branches.""" + url = os.getenv("TTS_LAYER_INDEX", + default="http://layers.openembedded.org/") + + lsobj = LayerSource.objects.create(\ + name="b1", sourcetype=LayerSource.TYPE_LAYERINDEX, + apiurl=url + "layerindex/api/") + lsobj.update() + self.assertTrue(lsobj.branch_set.all().count() > 0, + "no branches fetched") # tests to verify layer_version priority selection -- cgit v1.2.3-54-g00ecf