Esempio n. 1
0
 def test_no_stacked_on_url(self):
     # By default, a MirroredBranchPolicy does not stack branches.
     policy = MirroredBranchPolicy()
     # This implementation of the method doesn't actually care about the
     # arguments.
     self.assertIs(
         None, policy.getStackedOnURLForDestinationBranch(None, None))
Esempio n. 2
0
 def test_no_stacked_on_url(self):
     # By default, a MirroredBranchPolicy does not stack branches.
     policy = MirroredBranchPolicy()
     # This implementation of the method doesn't actually care about the
     # arguments.
     self.assertIs(None,
                   policy.getStackedOnURLForDestinationBranch(None, None))
Esempio n. 3
0
 def test_stacked_on_url_for_mirrored_branch(self):
     # If the default stacked-on URL is also the URL for the branch being
     # mirrored, then the stacked-on URL for destination branch is None.
     stacked_on_url = '/foo'
     policy = MirroredBranchPolicy(stacked_on_url)
     destination_url = 'http://example.com/foo'
     self.assertIs(
         None,
         policy.getStackedOnURLForDestinationBranch(None, destination_url))
Esempio n. 4
0
 def test_specified_stacked_on_url(self):
     # If a default stacked-on URL is specified, then the
     # MirroredBranchPolicy will tell branches to be stacked on that.
     stacked_on_url = '/foo'
     policy = MirroredBranchPolicy(stacked_on_url)
     destination_url = 'http://example.com/bar'
     self.assertEqual(
         '/foo',
         policy.getStackedOnURLForDestinationBranch(None, destination_url))
Esempio n. 5
0
 def test_stacked_on_url_for_mirrored_branch(self):
     # If the default stacked-on URL is also the URL for the branch being
     # mirrored, then the stacked-on URL for destination branch is None.
     stacked_on_url = '/foo'
     policy = MirroredBranchPolicy(stacked_on_url)
     destination_url = 'http://example.com/foo'
     self.assertIs(
         None,
         policy.getStackedOnURLForDestinationBranch(None, destination_url))
Esempio n. 6
0
 def test_specified_stacked_on_url(self):
     # If a default stacked-on URL is specified, then the
     # MirroredBranchPolicy will tell branches to be stacked on that.
     stacked_on_url = '/foo'
     policy = MirroredBranchPolicy(stacked_on_url)
     destination_url = 'http://example.com/bar'
     self.assertEqual(
         '/foo',
         policy.getStackedOnURLForDestinationBranch(None, destination_url))
Esempio n. 7
0
 def testLocalhost(self):
     self.pushConfig('codehosting',
                     blacklisted_hostnames='localhost,127.0.0.1')
     policy = MirroredBranchPolicy()
     localhost_url = self.factory.getUniqueURL(host='localhost')
     self.assertRaises(BadUrl, policy.checkOneURL, localhost_url)
     localhost_url = self.factory.getUniqueURL(host='127.0.0.1')
     self.assertRaises(BadUrl, policy.checkOneURL, localhost_url)
Esempio n. 8
0
 def testNoOtherHostLaunchpadURL(self):
     policy = MirroredBranchPolicy()
     self.assertRaises(BadUrlLaunchpad, policy.checkOneURL,
                       self.factory.getUniqueURL(host='code.launchpad.dev'))
Esempio n. 9
0
 def testNoHTTPSLaunchpadURL(self):
     policy = MirroredBranchPolicy()
     self.assertRaises(
         BadUrlLaunchpad, policy.checkOneURL,
         self.factory.getUniqueURL(host='bazaar.launchpad.dev',
                                   scheme='https'))
Esempio n. 10
0
 def testNoSftpURL(self):
     policy = MirroredBranchPolicy()
     self.assertRaises(BadUrlSsh, policy.checkOneURL,
                       self.factory.getUniqueURL(scheme='sftp'))
Esempio n. 11
0
 def testNoUnknownSchemeURLs(self):
     policy = MirroredBranchPolicy()
     self.assertRaises(BadUrlScheme, policy.checkOneURL,
                       self.factory.getUniqueURL(scheme='decorator+scheme'))
Esempio n. 12
0
 def testNoFileURL(self):
     policy = MirroredBranchPolicy()
     self.assertRaises(BadUrlScheme, policy.checkOneURL,
                       self.factory.getUniqueURL(scheme='file'))