|
7 | 7 | BzrFetcher,
|
8 | 8 | BzrMergeProposalFetcher,
|
9 | 9 | GithubFetcher,
|
| 10 | + OpendevFetcher, |
10 | 11 | GitFetcher,
|
11 | 12 | BitbucketFetcher,
|
12 | 13 | LocalFetcher,
|
@@ -132,6 +133,41 @@ def test_can_fetch(self):
|
132 | 133 | self.assertEqual(test, {})
|
133 | 134 |
|
134 | 135 |
|
| 136 | +class OpendevFetcherTest(unittest.TestCase): |
| 137 | + def test_can_fetch(self): |
| 138 | + f = OpendevFetcher.can_fetch |
| 139 | + |
| 140 | + good_tests = [ |
| 141 | + f('https://opendev.com/charms/foo'), |
| 142 | + f('https://www.opendev.com/charms/foo'), |
| 143 | + f('git@opendev.com:charms/foo'), |
| 144 | + ] |
| 145 | + |
| 146 | + bad_tests = [ |
| 147 | + f('http://www.opendev.com/charms/foo'), |
| 148 | + f('http://opendev.com/charms/foo'), |
| 149 | + f('gh:charms/foo'), |
| 150 | + f('github:charms/foo'), |
| 151 | + f('http://github.com/charms/foo'), |
| 152 | + f('https://github.com/charms/foo'), |
| 153 | + f('http://www.github.com/charms/foo'), |
| 154 | + f('https://www.github.com/charms/foo'), |
| 155 | + f('git@github.com:charms/foo'), |
| 156 | + f('lp:~openstack-charmers/charms/bionic/foo'), |
| 157 | + f('lp:~openstack-charmers/charms/bionic/foo/+merge/12345'), |
| 158 | + f('bb:charms/foo'), |
| 159 | + f('local:~/src/charms/bionic/foo'), |
| 160 | + f('cs:bionic/foo'), |
| 161 | + f('bundle:openstack-base/single'), |
| 162 | + ] |
| 163 | + |
| 164 | + for test in good_tests: |
| 165 | + self.assertEqual(test['repo'], 'charms/foo') |
| 166 | + |
| 167 | + for test in bad_tests: |
| 168 | + self.assertEqual(test, {}) |
| 169 | + |
| 170 | + |
135 | 171 | class GitFetcherTest(unittest.TestCase):
|
136 | 172 | def test_can_fetch(self):
|
137 | 173 | f = GitFetcher.can_fetch
|
|
0 commit comments