Пример #1
0
class TestBitbucketStatusPushRepoParsing(TestReactorMixin, unittest.TestCase):
    @defer.inlineCallbacks
    def setUp(self):
        self.setup_test_reactor()
        self.master = fakemaster.make_master(self,
                                             wantData=True,
                                             wantDb=True,
                                             wantMq=True)

        self.bsp = BitbucketStatusPush(Interpolate('key'),
                                       Interpolate('secret'))
        yield self.bsp.setServiceParent(self.master)
        yield self.bsp.startService()

    @defer.inlineCallbacks
    def tearDown(self):
        yield self.bsp.stopService()

    def parse(self, repourl):
        return tuple(self.bsp.get_owner_and_repo(repourl))

    def test_parse_no_scheme(self):
        self.assertEqual(('user', 'repo'),
                         self.parse('[email protected]:user/repo.git'))
        self.assertEqual(('user', 'repo'),
                         self.parse('[email protected]:user/repo'))

    def test_parse_with_scheme(self):
        self.assertEqual(('user', 'repo'),
                         self.parse('https://bitbucket.com/user/repo.git'))
        self.assertEqual(('user', 'repo'),
                         self.parse('https://bitbucket.com/user/repo'))

        self.assertEqual(('user', 'repo'),
                         self.parse('ssh://[email protected]/user/repo.git'))
        self.assertEqual(('user', 'repo'),
                         self.parse('ssh://[email protected]/user/repo'))
        self.assertEqual(
            ('user', 'repo'),
            self.parse('https://api.bitbucket.org/2.0/repositories/user/repo'))
Пример #2
0
 def parse(self, repourl):
     return tuple(BitbucketStatusPush.get_owner_and_repo(repourl))
Пример #3
0
 def parse(self, repourl):
     return tuple(BitbucketStatusPush.get_owner_and_repo(repourl))