~launchpad-pqm/launchpad/devel

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Copyright 2009 Canonical Ltd.  This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).

"""Tests that various objects implement specification-related interfaces."""

__metaclass__ = type

from lp.blueprints.interfaces.specificationtarget import (
    IHasSpecifications,
    ISpecificationTarget,
    )
from lp.testing import TestCaseWithFactory
from lp.testing.layers import DatabaseFunctionalLayer


class ImplementsIHasSpecificationsTests(TestCaseWithFactory):
    """Test that various objects implement IHasSpecifications."""
    layer = DatabaseFunctionalLayer

    def test_product_implements_IHasSpecifications(self):
        product = self.factory.makeProduct()
        self.assertProvides(product, IHasSpecifications)

    def test_distribution_implements_IHasSpecifications(self):
        product = self.factory.makeProduct()
        self.assertProvides(product, IHasSpecifications)

    def test_projectgroup_implements_IHasSpecifications(self):
        projectgroup = self.factory.makeProject()
        self.assertProvides(projectgroup, IHasSpecifications)

    def test_person_implements_IHasSpecifications(self):
        person = self.factory.makePerson()
        self.assertProvides(person, IHasSpecifications)

    def test_productseries_implements_IHasSpecifications(self):
        productseries = self.factory.makeProductSeries()
        self.assertProvides(productseries, IHasSpecifications)

    def test_distroseries_implements_IHasSpecifications(self):
        distroseries = self.factory.makeDistroSeries()
        self.assertProvides(distroseries, IHasSpecifications)

    def test_sprint_implements_IHasSpecifications(self):
        sprint = self.factory.makeSprint()
        self.assertProvides(sprint, IHasSpecifications)


class ImplementsISpecificationTargetTests(TestCaseWithFactory):
    """Test that various objects implement ISpecificationTarget."""
    layer = DatabaseFunctionalLayer

    def test_product_implements_ISpecificationTarget(self):
        product = self.factory.makeProduct()
        self.assertProvides(product, ISpecificationTarget)

    def test_distribution_implements_ISpecificationTarget(self):
        product = self.factory.makeProduct()
        self.assertProvides(product, ISpecificationTarget)

    def test_productseries_implements_ISpecificationTarget(self):
        productseries = self.factory.makeProductSeries()
        self.assertProvides(productseries, ISpecificationTarget)

    def test_distroseries_implements_ISpecificationTarget(self):
        distroseries = self.factory.makeDistroSeries()
        self.assertProvides(distroseries, ISpecificationTarget)