This repository was archived by the owner on Oct 9, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconftest.py
More file actions
121 lines (102 loc) · 3.17 KB
/
conftest.py
File metadata and controls
121 lines (102 loc) · 3.17 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# -*- coding: utf-8 -*-
"""Pytest configuration and fixtures for github_app_token_generator_package."""
import pytest # pylint: disable=import-error
from ..github_app_token_generator.github_api import GitHubAPIClient
@pytest.fixture
def github_api_client():
"""Create a GitHubAPIClient instance for testing."""
return GitHubAPIClient(timeout=30)
@pytest.fixture
def sample_jwt_token():
"""Sample JWT token for testing."""
return (
"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9."
"eyJpc3MiOiIxMjM0NTY3ODkwIiwiaWF0IjoxNjM5NjI2MDAwLCJleHAiOjE2Mzk2Mjk2MDB9."
"sample_jwt_token"
)
@pytest.fixture
def sample_installation_id():
"""Sample installation ID for testing."""
return 12345678
@pytest.fixture
def sample_installation_token():
"""Sample installation token for testing."""
return "ghs_1234567890abcdef1234567890abcdef12345678"
@pytest.fixture
def sample_access_token_response():
"""Sample access token response from GitHub API."""
return {
"token": "ghs_1234567890abcdef1234567890abcdef12345678",
"expires_at": "2023-12-31T23:59:59Z",
"permissions": {
"contents": "read",
"metadata": "read",
"pull_requests": "write",
},
"repository_selection": "selected",
}
@pytest.fixture
def sample_expected_token():
"""Expected token from the response."""
return "ghs_1234567890abcdef1234567890abcdef12345678"
@pytest.fixture
def sample_installations():
"""Sample installations list."""
return [
{
"id": 12345678,
"account": {"login": "testorg", "type": "Organization"},
"target_type": "Organization",
"created_at": "2023-01-01T00:00:00Z",
},
{
"id": 87654321,
"account": {"login": "testuser", "type": "User"},
"target_type": "User",
"created_at": "2023-02-01T00:00:00Z",
},
]
@pytest.fixture
def sample_repositories():
"""Sample repositories response."""
return {
"total_count": 3,
"repositories": [
{
"id": 123,
"full_name": "testorg/repo1",
"name": "repo1",
"private": False,
},
{
"id": 124,
"full_name": "testorg/repo2",
"name": "repo2",
"private": True,
},
{
"id": 125,
"full_name": "testorg/repo3",
"name": "repo3",
"private": False,
},
],
}
@pytest.fixture
def sample_app_info():
"""Sample GitHub App information."""
return {
"id": 123456,
"name": "Test GitHub App",
"slug": "test-github-app",
"description": "A test GitHub App for unit testing",
"owner": {"login": "testorg", "type": "Organization"},
"html_url": "https://github.com/apps/test-github-app",
"created_at": "2023-01-01T00:00:00Z",
"permissions": {
"contents": "read",
"metadata": "read",
"pull_requests": "write",
},
"events": ["push", "pull_request"],
}