~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/codehosting/tests/test_rewrite.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-04-20 03:16:35 UTC
  • mfrom: (12707.7.7 stack-on-branch-id-alias)
  • Revision ID: launchpad@pqm.canonical.com-20110420031635-39sx3wjbtxbm9l5j
[r=bac][bug=377519] Change the default stacking location to use the
 branch id alias.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
from canonical.config import config
18
18
from canonical.testing.layers import DatabaseFunctionalLayer
19
 
from lp.code.interfaces.codehosting import BRANCH_ID_ALIAS_PREFIX
 
19
from lp.code.interfaces.codehosting import branch_id_alias
20
20
from lp.codehosting.rewrite import BranchRewriter
21
21
from lp.codehosting.vfs import branch_id_to_path
22
22
from lp.services.log.logger import BufferLogger
102
102
            self.factory.makePackageBranch(private=False)]
103
103
        transaction.commit()
104
104
        output = [
105
 
            rewriter.rewriteLine("/%s/%s/.bzr/README" % (
106
 
                    BRANCH_ID_ALIAS_PREFIX, branch.id))
 
105
            rewriter.rewriteLine(
 
106
                "%s/.bzr/README" % branch_id_alias(branch))
107
107
            for branch in branches]
108
108
        expected = [
109
109
            'file:///var/tmp/bazaar.launchpad.dev/mirrors/%s/.bzr/README'
116
116
        # 'NULL'.  This is translated by apache to a 404.
117
117
        rewriter = self.makeRewriter()
118
118
        branch = self.factory.makeAnyBranch(private=True)
119
 
        path = '/%s/%s' % (
120
 
            BRANCH_ID_ALIAS_PREFIX, removeSecurityProxy(branch).id)
 
119
        path = branch_id_alias(removeSecurityProxy(branch))
121
120
        transaction.commit()
122
121
        output = [
123
122
            rewriter.rewriteLine("%s/changes" % path),
130
129
        rewriter = self.makeRewriter()
131
130
        branch = self.factory.makeAnyBranch()
132
131
        transaction.commit()
133
 
        path = "/%s/%s/.bzr/README" % (BRANCH_ID_ALIAS_PREFIX, branch.id)
 
132
        path = "%s/.bzr/README" % branch_id_alias(branch)
134
133
        rewriter.rewriteLine(path)
135
134
        rewriter.rewriteLine(path)
136
135
        logging_output_lines = self.getLoggerOutput(