import pytest from feed_status.resources import service_links @pytest.mark.parametrize( 'kwargs, expected', [ (dict(repo='repo1'), 'https://github.com/theorchard/repo1/tree/master'), (dict(repo='repo2', branch=None), 'https://github.com/theorchard/repo2'), (dict(repo='repo3', folder='/templates'), 'https://github.com/theorchard/repo3/tree/master/templates'), (dict(repo='repo4', org='otherorg', branch='main'), 'https://github.com/otherorg/repo4/tree/main'), ] ) def test_github_url(kwargs, expected): url = service_links.github_url(**kwargs) assert url == expected @pytest.mark.parametrize( 'kwargs, expected', [ (dict(repo='repo1'), 'https://pipeline.theorchard.io/job/theorchard/job/repo1/job/master/'), # noqa: E501 (dict(repo='repo2', server='scheduler'), 'https://scheduler.theorchard.io/job/theorchard/job/repo2/job/master/'), # noqa: E501 (dict(repo='repo3', branch='main'), 'https://pipeline.theorchard.io/job/theorchard/job/repo3/job/main/'), # noqa: E501 ] ) def test_jenkins_url_in_org_folder(kwargs, expected): url = service_links.jenkins_url_in_org_folder(**kwargs) assert url == expected @pytest.mark.parametrize( 'kwargs, expected', [ (dict(project_id='123'), 'https://the-orchard.sentry.io/issues/?project=123&statsPeriod=7d'), # noqa: E501 (dict(project_id='1234', account='someaccount'), 'https://someaccount.sentry.io/issues/?project=1234&statsPeriod=7d'), # noqa: E501 ] ) def test_sentry_urlL(kwargs, expected): url = service_links.sentryURL(**kwargs) assert url == expected