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))
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))
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))
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))
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)
def testNoOtherHostLaunchpadURL(self): policy = MirroredBranchPolicy() self.assertRaises(BadUrlLaunchpad, policy.checkOneURL, self.factory.getUniqueURL(host='code.launchpad.dev'))
def testNoHTTPSLaunchpadURL(self): policy = MirroredBranchPolicy() self.assertRaises( BadUrlLaunchpad, policy.checkOneURL, self.factory.getUniqueURL(host='bazaar.launchpad.dev', scheme='https'))
def testNoSftpURL(self): policy = MirroredBranchPolicy() self.assertRaises(BadUrlSsh, policy.checkOneURL, self.factory.getUniqueURL(scheme='sftp'))
def testNoUnknownSchemeURLs(self): policy = MirroredBranchPolicy() self.assertRaises(BadUrlScheme, policy.checkOneURL, self.factory.getUniqueURL(scheme='decorator+scheme'))
def testNoFileURL(self): policy = MirroredBranchPolicy() self.assertRaises(BadUrlScheme, policy.checkOneURL, self.factory.getUniqueURL(scheme='file'))