~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
# Copyright 2009 Canonical Ltd.  This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).

"""Tests for IBranchNavigationMenu implementations"""

__metaclass__ = type

from unittest import TestLoader

from canonical.testing.layers import LaunchpadZopelessLayer
from lp.code.interfaces.branch import IBranchNavigationMenu
from lp.testing import TestCaseWithFactory


class TestBranchNavigation(TestCaseWithFactory):

    layer = LaunchpadZopelessLayer

    def test_simple_branch(self):
        """Branches implement IBranchNavigation"""
        branch = self.factory.makeAnyBranch()
        self.assertTrue(IBranchNavigationMenu.providedBy(branch))

    def test_merge_proposal(self):
        """Merge proposals implement IBranchNavigation"""
        merge_proposal = self.factory.makeBranchMergeProposal()
        self.assertTrue(IBranchNavigationMenu.providedBy(merge_proposal))

    def test_branch_subscription(self):
        """Branch subscriptions implement IBranchNavigation"""
        subscription = self.factory.makeBranchSubscription()
        self.assertTrue(IBranchNavigationMenu.providedBy(subscription))

    def test_review_comment(self):
        """Review comments implement IBranchNavigation"""
        comment = self.factory.makeCodeReviewComment()
        self.assertTrue(IBranchNavigationMenu.providedBy(comment))


def test_suite():
    return TestLoader().loadTestsFromName(__name__)