Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id F1B10E00DE1; Tue, 5 Jul 2016 08:40:59 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low * trust * [209.85.192.173 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily * valid * -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Received: from mail-pf0-f173.google.com (mail-pf0-f173.google.com [209.85.192.173]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 6336FE00DD0 for ; Tue, 5 Jul 2016 08:40:35 -0700 (PDT) Received: by mail-pf0-f173.google.com with SMTP id h14so71113770pfe.1 for ; Tue, 05 Jul 2016 08:40:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ef7zMy6edIzcs8N4HnaoHJSni9dh5E2NFwDttNDS2ZU=; b=V0VDUM+SkxiD4Ru2woa0NhUuYAUrO24SRpoY9I6EhWPbJlkF1YmYwQb6w6ynM5t7gA b1SOirTmDobeBJUz/zN+FM+owh5l+ncQS9OZva1yVeJ8maGAGueHg/+N5CHYJe8N6w/F kMVMYArYhjP/ruFYl0fRPv/by3A2xWFZkQzYu3aHZJgaAhHEeQhRbVrNbaGquMdDcFP3 UQnoRh7IajtW0dWrrE8yN9uAGnSw8+znd+m8vNIuQTdHP/D/rKoxALmWxKAINfKTLm4a SjrzzY9Hsi+NhWBBnLkpQ9zTeZqo9aswj1vtkqufqVfuYE64gdKoSq52mP4mtIC47jTe ok1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ef7zMy6edIzcs8N4HnaoHJSni9dh5E2NFwDttNDS2ZU=; b=FVEfgfsz2xh9pkx6/zBWCr68j4zOAwjIxcs0NJBRhGdjd9EZpP4G3vX/cE9SPHeHom 1zyVCkaG+Yg0blj/gDhCqKhPL3j4WwPDrrLL8+NY93kyGFgmEUHrWpuqY0BhIk+SgQmH /3V9JTrJcCY8ahuI4lxlkFzf1uvXjze49lWo23zP2GoNQCtGXRz/3eX3VwaP0lJAJ2vG nIoGOJsRHcgQWzrEJ1+FhjrWRoi08sTF5K8F+Mm92g0l/orkCl3TF5dq1I+tfKRMxyTh gZKiXy7UZx0ASbvLY+8452JJ4iWpTwOq/Wq3TgWk7iuC8+GXOyHgsM1ybTpq8eFvbyL1 uE0A== X-Gm-Message-State: ALyK8tI6Aoq3/hPisRrgdNn+1jmoJvU6MEvI+AK/2wgqYjff/U4f8jIA8q9FV6yrGe7rDMad X-Received: by 10.98.3.3 with SMTP id 3mr33518996pfd.8.1467733234986; Tue, 05 Jul 2016 08:40:34 -0700 (PDT) Received: from orion.ger.corp.intel.com ([192.55.54.45]) by smtp.gmail.com with ESMTPSA id 203sm5961896pfz.35.2016.07.05.08.40.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 05 Jul 2016 08:40:34 -0700 (PDT) From: Michael Wood To: toaster@yoctoproject.org Date: Tue, 5 Jul 2016 16:40:14 +0100 Message-Id: <1467733217-3185-7-git-send-email-michael.g.wood@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1467733217-3185-1-git-send-email-michael.g.wood@intel.com> References: <1467733217-3185-1-git-send-email-michael.g.wood@intel.com> Subject: [PATCH 6/9] toaster: tests: Remove references to LayerSource model X-BeenThere: toaster@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Web based interface for BitBake List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jul 2016 15:41:00 -0000 Remove and replace layersource model references in the tests and test data. Remove the orm/test as this only tested LayerSource interactions which have now been removed. Signed-off-by: Michael Wood --- bitbake/lib/toaster/orm/tests.py | 180 --------------------- .../fixtures/toastergui-unittest-data.xml | 39 ----- bitbake/lib/toaster/toastergui/tests.py | 3 +- 3 files changed, 1 insertion(+), 221 deletions(-) delete mode 100644 bitbake/lib/toaster/orm/tests.py diff --git a/bitbake/lib/toaster/orm/tests.py b/bitbake/lib/toaster/orm/tests.py deleted file mode 100644 index 719266e..0000000 --- a/bitbake/lib/toaster/orm/tests.py +++ /dev/null @@ -1,180 +0,0 @@ -#! /usr/bin/env python -# ex:ts=4:sw=4:sts=4:et -# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- -# -# BitBake Toaster Implementation -# -# Copyright (C) 2013-2015 Intel Corporation -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2 as -# published by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -"""Test cases for Toaster ORM.""" - -from django.test import TestCase, TransactionTestCase -from orm.models import LocalLayerSource, LayerIndexLayerSource, ImportedLayerSource, LayerSource -from orm.models import Branch, LayerVersionDependency - -from orm.models import Project, Layer, Layer_Version, Branch, ProjectLayer -from orm.models import Release, ReleaseLayerSourcePriority, BitbakeVersion - -from django.db import IntegrityError - -import os - -# set TTS_LAYER_INDEX to the base url to use a different instance of the layer index - -class LayerSourceVerifyInheritanceSaveLoad(TestCase): - """ - Tests to verify inheritance for the LayerSource proxy-inheritance classes. - """ - def test_object_creation(self): - """Test LayerSource object creation.""" - for name, sourcetype in [("a1", LayerSource.TYPE_LOCAL), - ("a2", LayerSource.TYPE_LAYERINDEX), - ("a3", LayerSource.TYPE_IMPORTED)]: - LayerSource.objects.create(name=name, sourcetype=sourcetype) - - objects = LayerSource.objects.all() - self.assertTrue(isinstance(objects[0], LocalLayerSource)) - self.assertTrue(isinstance(objects[1], LayerIndexLayerSource)) - self.assertTrue(isinstance(objects[2], ImportedLayerSource)) - - def test_duplicate_error(self): - """Test creation of duplicate LayerSource objects.""" - stype = LayerSource.TYPE_LOCAL - LayerSource.objects.create(name="a1", sourcetype=stype) - with self.assertRaises(IntegrityError): - LayerSource.objects.create(name="a1", sourcetype=stype) - - -class LILSUpdateTestCase(TransactionTestCase): - """Test Layer Source update.""" - - def setUp(self): - """Create release.""" - bbv = BitbakeVersion.objects.create(\ - name="master", giturl="git://git.openembedded.org/bitbake") - Release.objects.create(name="default-release", bitbake_version=bbv, - branch_name="master") - - def test_update(self): - """Check if LayerSource.update can fetch branches.""" - url = os.getenv("TTS_LAYER_INDEX", - default="http://layers.openembedded.org/") - - lsobj = LayerSource.objects.create(\ - name="b1", sourcetype=LayerSource.TYPE_LAYERINDEX, - apiurl=url + "layerindex/api/") - lsobj.update() - self.assertTrue(lsobj.branch_set.all().count() > 0, - "no branches fetched") - -class LayerVersionEquivalenceTestCase(TestCase): - """Verify Layer_Version priority selection.""" - - def setUp(self): - """Create required objects.""" - # create layer source - self.lsrc = LayerSource.objects.create(name="dummy-layersource", - sourcetype=LayerSource.TYPE_LOCAL) - # create release - bbv = BitbakeVersion.objects.create(\ - name="master", giturl="git://git.openembedded.org/bitbake") - self.release = Release.objects.create(name="default-release", - bitbake_version=bbv, - branch_name="master") - # attach layer source to release - ReleaseLayerSourcePriority.objects.create(\ - release=self.release, layer_source=self.lsrc, priority=1) - - # create a layer version for the layer on the specified branch - self.layer = Layer.objects.create(name="meta-testlayer", - layer_source=self.lsrc) - self.branch = Branch.objects.create(name="master", layer_source=self.lsrc) - self.lver = Layer_Version.objects.create(\ - layer=self.layer, layer_source=self.lsrc, up_branch=self.branch) - - # create project and project layer - self.project = Project.objects.create_project(name="test-project", - release=self.release) - ProjectLayer.objects.create(project=self.project, - layercommit=self.lver) - - # create spoof layer that should not appear in the search results - layer = Layer.objects.create(name="meta-notvalid", - layer_source=self.lsrc) - self.lver2 = Layer_Version.objects.create(layer=layer, - layer_source=self.lsrc, - up_branch=self.branch) - - def test_single_layersource(self): - """ - When we have a single layer version, - get_equivalents_wpriority() should return a list with - just this layer_version. - """ - equivqs = self.lver.get_equivalents_wpriority(self.project) - self.assertEqual(list(equivqs), [self.lver]) - - def test_dual_layersource(self): - """ - If we have two layers with the same name, from different layer sources, - we expect both layers in, in increasing priority of the layer source. - """ - lsrc2 = LayerSource.objects.create(\ - name="dummy-layersource2", - sourcetype=LayerSource.TYPE_LOCAL, - apiurl="test") - - # assign a lower priority for the second layer source - self.release.releaselayersourcepriority_set.create(layer_source=lsrc2, - priority=2) - - # create a new layer_version for a layer with the same name - # coming from the second layer source - layer2 = Layer.objects.create(name="meta-testlayer", - layer_source=lsrc2) - lver2 = Layer_Version.objects.create(layer=layer2, layer_source=lsrc2, - up_branch=self.branch) - - # expect two layer versions, in the priority order - equivqs = self.lver.get_equivalents_wpriority(self.project) - self.assertEqual(list(equivqs), [lver2, self.lver]) - - def test_compatible_layer_versions(self): - """ - When we have a 2 layer versions, get_all_compatible_layerversions() - should return a queryset with both. - """ - compat_lv = self.project.get_all_compatible_layer_versions() - self.assertEqual(list(compat_lv), [self.lver, self.lver2]) - - def test_layerversion_get_alldeps(self): - """Test Layer_Version.get_alldeps API.""" - lvers = {} - for i in range(10): - name = "layer%d" % i - lvers[name] = Layer_Version.objects.create(layer=Layer.objects.create(name=name), - project=self.project) - if i: - LayerVersionDependency.objects.create(layer_version=lvers["layer%d" % (i - 1)], - depends_on=lvers[name]) - # Check dinamically added deps - self.assertEqual(lvers['layer0'].get_alldeps(self.project.id), - [lvers['layer%d' % n] for n in range(1, i+1)]) - - # Check chain of deps created in previous loop - for i in range(10): - self.assertEqual(lvers['layer%d' % i].get_alldeps(self.project.id), - [lvers['layer%d' % n] for n in range(i+1, 10)]) diff --git a/bitbake/lib/toaster/toastergui/fixtures/toastergui-unittest-data.xml b/bitbake/lib/toaster/toastergui/fixtures/toastergui-unittest-data.xml index 213bf0f..80c1e19 100644 --- a/bitbake/lib/toaster/toastergui/fixtures/toastergui-unittest-data.xml +++ b/bitbake/lib/toaster/toastergui/fixtures/toastergui-unittest-data.xml @@ -195,8 +195,6 @@ - 1 - z recipe 5.2 @@ -212,8 +210,6 @@ False - 1 - a recipe 1.2 @@ -229,8 +225,6 @@ False - - a custom recipe @@ -246,8 +240,6 @@ False - 1 - a image recipe 1.2 @@ -263,8 +255,6 @@ True - 1 - z image recipe 1.3 @@ -280,8 +270,6 @@ True - - z custom recipe @@ -307,34 +295,23 @@ - - 1 a machine a machine - - 2 z machine z machine - - 1 g machine g machine - - local - 1 - - test bbv /tmp/ @@ -355,26 +332,16 @@ master - - 1 - 1 - 0 - - 1 master - - a layer /tmp/ - 1 - z layer @@ -383,8 +350,6 @@ 1 1 - 1 - 1 master @@ -397,8 +362,6 @@ 2 - 1 - 1 testing-branch @@ -411,8 +374,6 @@ 1 2 - 1 - 1 testing-branch diff --git a/bitbake/lib/toaster/toastergui/tests.py b/bitbake/lib/toaster/toastergui/tests.py index da530a1..03b73a9 100644 --- a/bitbake/lib/toaster/toastergui/tests.py +++ b/bitbake/lib/toaster/toastergui/tests.py @@ -28,7 +28,7 @@ from django.utils import timezone from django.db.models import Q from orm.models import Project, Release, BitbakeVersion, Package, LogMessage -from orm.models import ReleaseLayerSourcePriority, LayerSource, Layer, Build +from orm.models import LayerSource, Layer, Build from orm.models import Layer_Version, Recipe, Machine, ProjectLayer, Target from orm.models import CustomImageRecipe, ProjectVariable from orm.models import Branch, CustomImagePackage @@ -149,7 +149,6 @@ class ViewTests(TestCase): def test_xhr_import_layer(self): """Test xhr_importlayer API""" - LayerSource.objects.create(sourcetype=LayerSource.TYPE_IMPORTED) #Test for importing an already existing layer args = {'vcs_url' : "git://git.example.com/test", 'name' : "base-layer", -- 2.7.4