Brad Bishop | 96ff198 | 2019-08-19 13:50:42 -0400 | [diff] [blame^] | 1 | #! /usr/bin/env python3 |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 2 | # |
| 3 | # BitBake Toaster Implementation |
| 4 | # |
| 5 | # Copyright (C) 2016 Intel Corporation |
| 6 | # |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 7 | # SPDX-License-Identifier: GPL-2.0-only |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 8 | # |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 9 | |
| 10 | from django.test import TestCase |
| 11 | from django.core import management |
| 12 | |
| 13 | from orm.models import Layer_Version, Machine, Recipe |
| 14 | |
| 15 | |
| 16 | class TestLayerIndexUpdater(TestCase): |
| 17 | def test_run_lsupdates_command(self): |
| 18 | # Load some release information for us to fetch from the layer index |
| 19 | management.call_command('loaddata', 'poky') |
| 20 | |
| 21 | old_layers_count = Layer_Version.objects.count() |
| 22 | old_recipes_count = Recipe.objects.count() |
| 23 | old_machines_count = Machine.objects.count() |
| 24 | |
| 25 | # Now fetch the metadata from the layer index |
| 26 | management.call_command('lsupdates') |
| 27 | |
| 28 | self.assertTrue(Layer_Version.objects.count() > old_layers_count, |
| 29 | "lsupdates ran but we still have no more layers!") |
| 30 | self.assertTrue(Recipe.objects.count() > old_recipes_count, |
| 31 | "lsupdates ran but we still have no more Recipes!") |
| 32 | self.assertTrue(Machine.objects.count() > old_machines_count, |
| 33 | "lsupdates ran but we still have no more Machines!") |