summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2015-08-10 18:27:11 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-08-10 13:58:00 -0700
commit8af82c207d1a1cce4f0d9bc3eb438051dc63909f (patch)
treecb5ea0c5bcf5c58af3e92406df331b99f069fb1c /bitbake
parent2f8c8e4c31aaf36bc5e11cf7847866c025e1c5c1 (diff)
downloadpoky-8af82c207d1a1cce4f0d9bc3eb438051dc63909f.tar.gz
bitbake: toaster: put all test cases into one class
Moved all functionality (one setup method and one test case) from ProvisionedLayersProjectTestCase and XHRDataTypeAheadTestCase to AllProjectsViewTestCase. Renamed AllProjectsViewTestCase -> ViewTests. (Bitbake rev: d87dc9a03bb2d1c21551894d611a4312254f46ef) 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/toastergui/tests.py63
1 files changed, 29 insertions, 34 deletions
diff --git a/bitbake/lib/toaster/toastergui/tests.py b/bitbake/lib/toaster/toastergui/tests.py
index 6f3930db93..986e6a5461 100644
--- a/bitbake/lib/toaster/toastergui/tests.py
+++ b/bitbake/lib/toaster/toastergui/tests.py
@@ -7,7 +7,10 @@ import json
7 7
8PROJECT_NAME = "test project" 8PROJECT_NAME = "test project"
9 9
10class AllProjectsViewTestCase(TestCase): 10class ViewTests(TestCase):
11 """Tests to verify view APIs."""
12 LAYER_NAME = "base-layer"
13 RECIPE_NAME = "base-recipe"
11 14
12 def setUp(self): 15 def setUp(self):
13 self.bbv = BitbakeVersion.objects.create(\ 16 self.bbv = BitbakeVersion.objects.create(\
@@ -17,6 +20,31 @@ class AllProjectsViewTestCase(TestCase):
17 name="test release", bitbake_version=self.bbv) 20 name="test release", bitbake_version=self.bbv)
18 self.project = Project.objects.create_project(name=PROJECT_NAME, 21 self.project = Project.objects.create_project(name=PROJECT_NAME,
19 release=self.release) 22 release=self.release)
23 self.layersrc = LayerSource.objects.create(\
24 sourcetype=LayerSource.TYPE_IMPORTED)
25 self.priority = ReleaseLayerSourcePriority.objects.create(\
26 release=self.release,
27 layer_source=self.layersrc)
28 self.layer = Layer.objects.create(\
29 name=self.LAYER_NAME,
30 layer_source=self.layersrc, vcs_url="/tmp/")
31 self.lver = Layer_Version.objects.create(\
32 layer=self.layer, project=self.project,
33 layer_source=self.layersrc, commit="master")
34
35 self.recipe = Recipe.objects.create(\
36 layer_source=self.layersrc, name=self.RECIPE_NAME,
37 version="1.2", summary="one recipe",
38 description="recipe", layer_version=self.lver)
39
40 self.machine = Machine.objects.create(\
41 layer_version=self.lver, name="wisk",
42 description="wisking machine")
43
44 ProjectLayer.objects.create(project=self.project,
45 layercommit=self.lver)
46
47 self.assertTrue(self.lver in self.project.compatible_layerversions())
20 48
21 def test_get_base_call_returns_html(self): 49 def test_get_base_call_returns_html(self):
22 response = self.client.get(reverse('all-projects'), follow=True) 50 response = self.client.get(reverse('all-projects'), follow=True)
@@ -46,39 +74,6 @@ class AllProjectsViewTestCase(TestCase):
46 self.assertTrue("projectPageUrl" in data["rows"][0]) 74 self.assertTrue("projectPageUrl" in data["rows"][0])
47 self.assertTrue("projectBuildsUrl" in data["rows"][0]) 75 self.assertTrue("projectBuildsUrl" in data["rows"][0])
48 76
49class ProvisionedLayersProjectTestCase(ProvisionedProjectTestCase):
50 LAYER_NAME = "base-layer"
51 RECIPE_NAME = "base-recipe"
52
53
54 def setUp(self):
55 super(ProvisionedLayersProjectTestCase, self).setUp()
56 self.layersrc = LayerSource.objects.create(\
57 sourcetype=LayerSource.TYPE_IMPORTED)
58 self.priority = ReleaseLayerSourcePriority.objects.create(\
59 release=self.release,
60 layer_source=self.layersrc)
61 self.layer = Layer.objects.create(\
62 name=XHRDataTypeAheadTestCase.LAYER_NAME,
63 layer_source=self.layersrc, vcs_url="/tmp/")
64 self.lver = Layer_Version.objects.create(\
65 layer=self.layer, project=self.project,
66 layer_source=self.layersrc, commit="master")
67
68 self.recipe, created = Recipe.objects.get_or_create(layer_source=self.layersource, name=ProvisionedLayersProjectTestCase.RECIPE_NAME, version="1.2", summary="one recipe", description="recipe", layer_version=self.lv)
69
70 self.machine, created = Machine.objects.get_or_create(layer_version=self.lv, name="wisk", description="wisking machine")
71
72 ProjectLayer.objects.get_or_create(project = self.project,
73 layercommit = self.lv)
74
75
76class XHRDataTypeAheadTestCase(ProvisionedLayersProjectTestCase):
77
78 def setUp(self):
79 super(XHRDataTypeAheadTestCase, self).setUp()
80 self.assertTrue(self.lver in self.project.compatible_layerversions())
81
82 def test_typeaheads(self): 77 def test_typeaheads(self):
83 layers_url = reverse('xhr_layerstypeahead', args=(self.project.id,)) 78 layers_url = reverse('xhr_layerstypeahead', args=(self.project.id,))
84 prj_url = reverse('xhr_projectstypeahead') 79 prj_url = reverse('xhr_projectstypeahead')