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
|
# Copyright 2010 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for product views."""
__metaclass__ = type
import unittest
from canonical.testing.layers import DatabaseFunctionalLayer
from lp.testing import TestCaseWithFactory
class TestProjectBranches(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
def setUp(self):
super(TestProjectBranches, self).setUp()
self.project = self.factory.makeProject()
self.product = self.factory.makeProduct(project=self.project)
def test_has_branches_with_no_branches(self):
# If there are no product branches on the project's products, then
# has branches returns False.
self.assertFalse(self.project.has_branches())
def test_has_branches_with_branches(self):
# If a product has a branch, then the product's project returns
# true for has_branches.
self.factory.makeProductBranch(product=self.product)
self.assertTrue(self.project.has_branches())
def test_suite():
return unittest.TestLoader().loadTestsFromName(__name__)
|