~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/code/model/tests/test_sourcepackagerecipe.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-10-19 02:33:39 UTC
  • mfrom: (14162.1.4 bug-870130)
  • Revision ID: launchpad@pqm.canonical.com-20111019023339-1i3g2tzvz00gme5a
[r=gmb][bug=870130] Exclude some problematic attributes from API
 snapshots.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
import textwrap
13
13
 
14
14
from bzrlib.plugins.builder.recipe import ForbiddenInstructionError
 
15
from lazr.lifecycle.event import ObjectModifiedEvent
15
16
from pytz import UTC
16
17
from storm.locals import Store
17
18
import transaction
20
21
from zope.security.interfaces import Unauthorized
21
22
from zope.security.proxy import removeSecurityProxy
22
23
 
23
 
from lazr.lifecycle.event import ObjectModifiedEvent
24
24
from canonical.database.constants import UTC_NOW
25
25
from canonical.launchpad.webapp.authorization import check_permission
26
26
from canonical.launchpad.webapp.testing import verifyObject
40
40
from lp.code.interfaces.sourcepackagerecipe import (
41
41
    ISourcePackageRecipe,
42
42
    ISourcePackageRecipeSource,
 
43
    ISourcePackageRecipeView,
43
44
    MINIMAL_RECIPE_TEXT,
44
45
    )
45
46
from lp.code.interfaces.sourcepackagerecipebuild import (
76
77
    TestCaseWithFactory,
77
78
    ws_object,
78
79
    )
 
80
from lp.testing.matchers import DoesNotSnapshot
79
81
 
80
82
 
81
83
class TestSourcePackageRecipe(TestCaseWithFactory):
92
94
        recipe = self.factory.makeSourcePackageRecipe()
93
95
        verifyObject(ISourcePackageRecipe, recipe)
94
96
 
 
97
    def test_avoids_problematic_snapshots(self):
 
98
        problematic_properties = [
 
99
            'builds',
 
100
            'completed_builds',
 
101
            'pending_builds',
 
102
            ]
 
103
        self.assertThat(
 
104
            self.factory.makeSourcePackageRecipe(),
 
105
            DoesNotSnapshot(problematic_properties, ISourcePackageRecipeView))
 
106
 
95
107
    def makeRecipeComponents(self, branches=()):
96
108
        """Return a dict of values that can be used to make a recipe.
97
109