@@ -154,14 +154,16 @@ def test_get_datafile_contents(gh, session):
154154
155155
156156@pytest .mark .parametrize (
157- "is_public, expected" ,
157+ "github_host, is_public, expected" ,
158158 [
159- (False , "https://github.com/foo/bar/raw/baz/qux" ),
160- (True , "https://raw.githubusercontent.com/foo/bar/baz/qux" ),
159+ ("https://github.com" , False , "https://github.com/foo/bar/raw/baz/qux" ),
160+ ("https://github.com" , True , "https://raw.githubusercontent.com/foo/bar/baz/qux" ),
161+ ("https://github.mycompany.com" , True , "https://github.mycompany.com/foo/bar/raw/baz/qux" ),
161162 ],
162163)
163- def test_get_raw_file_url (is_public , expected ):
164+ def test_get_raw_file_url (github_host , is_public , expected ):
164165 result = storage .get_raw_file_url (
166+ github_host = github_host ,
165167 repository = "foo/bar" ,
166168 branch = "baz" ,
167169 path = pathlib .Path ("qux" ),
@@ -171,29 +173,40 @@ def test_get_raw_file_url(is_public, expected):
171173
172174
173175@pytest .mark .parametrize (
174- "path, expected" ,
176+ "github_host, path, expected" ,
175177 [
176- ("" , "https://github.com/foo/bar/tree/baz" ),
177- ("/" , "https://github.com/foo/bar/tree/baz" ),
178- ("qux" , "https://github.com/foo/bar/blob/baz/qux" ), # blob
179- ("qux/" , "https://github.com/foo/bar/tree/baz/qux" ),
180- ("/ qux" , "https://github.com/foo/bar/blob/baz/qux" ), # blob
181- ("/ qux/" , "https://github.com/foo/bar/tree/baz/qux" ),
178+ ("https://github.com" , " " , "https://github.com/foo/bar/tree/baz" ),
179+ ("https://github.com" , " /" , "https://github.com/foo/bar/tree/baz" ),
180+ ("https://github.com" , " qux" , "https://github.com/foo/bar/blob/baz/qux" ), # blob
181+ ("https://github.com" , " qux/" , "https://github.com/foo/bar/tree/baz/qux" ),
182+ ("https://github.mycompany.com" , "/ qux" , "https://github.mycompany .com/foo/bar/blob/baz/qux" ), # blob
183+ ("https://github.mycompany.com" , "/ qux/" , "https://github.mycompany .com/foo/bar/tree/baz/qux" ),
182184 ],
183185)
184- def test_get_repo_file_url (path , expected ):
185- result = storage .get_repo_file_url (repository = "foo/bar" , branch = "baz" , path = path )
186+ def test_get_repo_file_url (github_host , path , expected ):
187+ result = storage .get_repo_file_url (github_host = github_host , repository = "foo/bar" , branch = "baz" , path = path )
186188
187189 assert result == expected
188190
191+ @pytest .mark .parametrize (
192+ "github_host" ,
193+ [
194+ "https://github.com" ,
195+ "https://github.mycompany.com" ,
196+ ],
197+ )
198+ def test_get_repo_file_url__no_path (github_host ):
199+ result = storage .get_repo_file_url (github_host = github_host , repository = "foo/bar" , branch = "baz" )
189200
190- def test_get_repo_file_url__no_path ():
191- result = storage .get_repo_file_url (repository = "foo/bar" , branch = "baz" )
192-
193- assert result == "https://github.com/foo/bar/tree/baz"
194-
201+ assert result == f"{ github_host } /foo/bar/tree/baz"
195202
196- def test_get_html_report_url ():
197- result = storage .get_html_report_url (repository = "foo/bar" , branch = "baz" )
198- expected = "https://htmlpreview.github.io/?https://github.com/foo/bar/blob/baz/htmlcov/index.html"
203+ @pytest .mark .parametrize (
204+ "github_host, expected" ,
205+ [
206+ ("https://github.com" , "https://htmlpreview.github.io/?https://github.com/foo/bar/blob/baz/htmlcov/index.html" ),
207+ ("https://github.mycompany.com" , "https://github.mycompany.com/foo/bar/blob/baz/htmlcov/index.html" ),
208+ ],
209+ )
210+ def test_get_html_report_url (github_host , expected ):
211+ result = storage .get_html_report_url (github_host = github_host , repository = "foo/bar" , branch = "baz" )
199212 assert result == expected
0 commit comments