Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame^] | 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)") |