-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_ghpr.py
37 lines (26 loc) · 1.27 KB
/
test_ghpr.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from src.helpers.githubHelper import parse_github_url, parse_ticket_id, parse_github_user
def test_githubHelper():
invalid_url = None
valid_ernterprise_url = 'https://github.comcast.com/BSD-Digital/business-voice-ui-assets/pull/376'
valid_github_url = 'https://github.com/PyGithub/PyGithub/pull/1890'
hostname, org, repo, pr_or_issue_number = parse_github_url(invalid_url)
assert hostname == None
assert org == None
assert repo == None
assert pr_or_issue_number == None
hostname, org, repo, pr_or_issue_number = parse_github_url(valid_ernterprise_url)
assert hostname == 'github.comcast.com'
assert org == 'BSD-Digital'
assert repo == 'business-voice-ui-assets'
assert pr_or_issue_number == '376'
hostname, org, repo, pr_or_issue_number = parse_github_url(valid_github_url)
assert hostname == 'github.com'
assert org == 'PyGithub'
assert repo == 'PyGithub'
assert pr_or_issue_number == '1890'
def test_parseTicketId():
valid_ticket_id = 'ABC123'
assert parse_ticket_id('ABC123 : changes related to resend invite version2') == valid_ticket_id
def test_parseGithubUser():
valid_user = 'octocat'
assert parse_github_user('https://api.github.com/users/octocat') == valid_user