[bitbake-devel] [PATCH 04/11] toaster: rewrite LILSUpdateTestCase
Michael Wood
michael.g.wood at intel.com
Mon Aug 10 11:21:27 UTC 2015
From: Ed Bartosh <ed.bartosh at linux.intel.com>
Reformatted code. Added docstings.
Signed-off-by: Ed Bartosh <ed.bartosh at linux.intel.com>
Signed-off-by: Michael Wood <michael.g.wood at intel.com>
---
lib/toaster/orm/tests.py | 30 +++++++++++++++++-------------
1 file changed, 17 insertions(+), 13 deletions(-)
diff --git a/lib/toaster/orm/tests.py b/lib/toaster/orm/tests.py
index b0c01db..3384f01 100644
--- a/lib/toaster/orm/tests.py
+++ b/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
--
2.1.4
More information about the bitbake-devel
mailing list