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
|
# Copyright 2009 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Unit tests for BranchSubscriptions."""
__metaclass__ = type
import unittest
from canonical.launchpad.webapp.interfaces import IPrimaryContext
from canonical.testing.layers import DatabaseFunctionalLayer
from lp.testing import TestCaseWithFactory
class TestBranchSubscriptionPrimaryContext(TestCaseWithFactory):
# Tests the adaptation of a branch subscription into a primary context.
layer = DatabaseFunctionalLayer
def testPrimaryContext(self):
# The primary context of a branch subscription is the same as the
# primary context of the branch that the subscription is for.
subscription = self.factory.makeBranchSubscription()
self.assertEqual(
IPrimaryContext(subscription).context,
IPrimaryContext(subscription.branch).context)
def test_suite():
return unittest.TestLoader().loadTestsFromName(__name__)
|