-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_github_client.py
More file actions
36 lines (30 loc) · 1.07 KB
/
test_github_client.py
File metadata and controls
36 lines (30 loc) · 1.07 KB
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
"""
test_github_client.py — Tests for GitHub client (uses mocks — no real API calls).
"""
import sys
import os
import pathlib
import pytest
from unittest.mock import patch, MagicMock
sys.path.insert(0, str(pathlib.Path(__file__).parent.parent))
os.environ.setdefault("CEREBRAS_API_KEY", "test_key")
os.environ.setdefault("GITHUB_TOKEN", "test_token")
from tools.github_client import parse_issue_url
class TestParseIssueUrl:
def test_standard_url(self):
owner, repo, number = parse_issue_url(
"https://github.com/openai/openai-python/issues/123"
)
assert owner == "openai"
assert repo == "openai-python"
assert number == 123
def test_url_with_anchor(self):
owner, repo, number = parse_issue_url(
"https://github.com/django/django/issues/456#issuecomment-789"
)
assert owner == "django"
assert repo == "django"
assert number == 456
def test_invalid_url_raises(self):
with pytest.raises(ValueError):
parse_issue_url("https://example.com/not-github")