1#! /usr/bin/env python3 2# 3# BitBake Toaster Implementation 4# 5# Copyright (C) 2016 Intel Corporation 6# 7# SPDX-License-Identifier: GPL-2.0-only 8# 9 10from django.test import TestCase 11from django.core import management 12 13from orm.models import Layer_Version, Machine, Recipe 14 15 16class 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!") 34