コード例 #1
0
    def test_check_url_valid(self):
        tc_arr = [
            {
                'obj':
                Git(self.cli, self.tasks),
                'urls': [
                    'http://example.com',
                    'https://example.com',
                    'ftp://example.com',
                    'ftps://example.com',
                    'git://example.com',
                    'ssh://example.com',
                    'example.com:/path/to/remote/repo',
                    '[email protected]:/path/to/remote/repo',
                    '[email protected]:/path/to/remote/repo',
                    '[email protected]:/path/to/remote/repo',
                ]
            },
            {
                'obj':
                Bzr(self.cli, self.tasks),
                'urls': [
                    'http://example.com',
                    'https://example.com',
                    'ftp://example.com',
                    'aftp://example.com',
                    'bzr://example.com',
                    'lp://example.com',
                ]
            },
            {
                'obj': Hg(self.cli, self.tasks),
                'urls': [
                    'http://example.com',
                    'https://example.com',
                ]
            },
            {
                'obj':
                Svn(self.cli, self.tasks),
                'urls': [
                    'http://example.com',
                    'https://example.com',
                    'svn://example.com',
                ]
            },
        ]

        for tca in tc_arr:
            for url in tca['urls']:
                tca['obj'].url = url
                self.assertTrue(tca['obj'].check_url())
コード例 #2
0
    def test_check_url_invalid(self):
        invalid = [
            'Xhttp://example.com', 'Xhttps://example.com',
            'Xftp://example.com', 'Xftps://example.com', 'Xaftp://example.com',
            'Xbzr://example.com', 'Xlp://example.com', 'Xgit://example.com',
            'Xssh://example.com', 'Xsvn://example.com', '/lala/nana',
            '/tmp/[email protected]:my/local/path'
            '/tmp/example.com:my/local/path'
        ]

        scms = [
            Git(self.cli, self.tasks),
            Bzr(self.cli, self.tasks),
            Hg(self.cli, self.tasks),
            Svn(self.cli, self.tasks),
        ]

        for scm in scms:
            for url in invalid:
                print("%r %s" % (scm, url))
                scm.url = url
                self.assertFalse(scm.check_url())