diff options
Diffstat (limited to 'bitbake/lib/toaster/tests/commands/test_loaddata.py')
-rw-r--r-- | bitbake/lib/toaster/tests/commands/test_loaddata.py | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/tests/commands/test_loaddata.py b/bitbake/lib/toaster/tests/commands/test_loaddata.py new file mode 100644 index 0000000000..951f6ff5aa --- /dev/null +++ b/bitbake/lib/toaster/tests/commands/test_loaddata.py | |||
@@ -0,0 +1,61 @@ | |||
1 | #! /usr/bin/env python | ||
2 | # ex:ts=4:sw=4:sts=4:et | ||
3 | # -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- | ||
4 | # | ||
5 | # BitBake Toaster Implementation | ||
6 | # | ||
7 | # Copyright (C) 2016 Intel Corporation | ||
8 | # | ||
9 | # This program is free software; you can redistribute it and/or modify | ||
10 | # it under the terms of the GNU General Public License version 2 as | ||
11 | # published by the Free Software Foundation. | ||
12 | # | ||
13 | # This program is distributed in the hope that it will be useful, | ||
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | # GNU General Public License for more details. | ||
17 | # | ||
18 | # You should have received a copy of the GNU General Public License along | ||
19 | # with this program; if not, write to the Free Software Foundation, Inc., | ||
20 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
21 | |||
22 | from django.test import TestCase | ||
23 | from django.core import management | ||
24 | |||
25 | from orm.models import Layer_Version, Layer, Release, ToasterSetting | ||
26 | |||
27 | |||
28 | class TestLoadDataFixtures(TestCase): | ||
29 | """ Test loading our 3 provided fixtures """ | ||
30 | def test_run_loaddata_poky_command(self): | ||
31 | management.call_command('loaddata', 'poky') | ||
32 | |||
33 | num_releases = Release.objects.count() | ||
34 | |||
35 | self.assertTrue( | ||
36 | Layer_Version.objects.filter( | ||
37 | layer__name="meta-poky").count() == num_releases, | ||
38 | "Loaded poky fixture but don't have a meta-poky for all releases" | ||
39 | " defined") | ||
40 | |||
41 | def test_run_loaddata_oecore_command(self): | ||
42 | management.call_command('loaddata', 'oe-core') | ||
43 | |||
44 | # We only have the one layer for oe-core setup | ||
45 | self.assertTrue( | ||
46 | Layer.objects.filter(name="openembedded-core").count() > 0, | ||
47 | "Loaded oe-core fixture but still have no openemebedded-core" | ||
48 | " layer") | ||
49 | |||
50 | def test_run_loaddata_settings_command(self): | ||
51 | management.call_command('loaddata', 'settings') | ||
52 | |||
53 | self.assertTrue( | ||
54 | ToasterSetting.objects.filter(name="DEFAULT_RELEASE").count() > 0, | ||
55 | "Loaded settings but have no DEFAULT_RELEASE") | ||
56 | |||
57 | self.assertTrue( | ||
58 | ToasterSetting.objects.filter( | ||
59 | name__startswith="DEFCONF").count() > 0, | ||
60 | "Loaded settings but have no DEFCONF (default project " | ||
61 | "configuration values)") | ||