Skip to content

Commit d477a79

Browse files
committed
Refactor Pagure and factory tests
- Fix Pagure tests - `PagurePullRequest` - changed `project` -> `target_project` - `test_add_user/group` - use user's playground - `test_pr_status` - Use `head_commit` for setting commit status - Use `>=` instead of `==` for edited/created to prevent TZ problems Signed-off-by: Matej Focko <[email protected]>
1 parent 715a3d7 commit d477a79

File tree

216 files changed

+612805
-627716
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

216 files changed

+612805
-627716
lines changed

.pre-commit-config.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ repos:
1111
rev: 2.1.1
1212
hooks:
1313
- id: prettier
14-
exclude: tests/integration/test_data/*
15-
exclude: tests/integration/*/test_data/*
1614
- repo: https://github.com/pre-commit/pre-commit-hooks
1715
rev: v3.2.0
1816
hooks:

.prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
tests/integration/*/test_data/*

ogr/services/pagure/pull_request.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def status(self) -> PRStatus:
6969
def url(self) -> str:
7070
return "/".join(
7171
[
72-
self.project.service.instance_url,
72+
self.target_project.service.instance_url,
7373
self._raw_pr["project"]["url_path"],
7474
"pull-request",
7575
str(self.id),
@@ -264,7 +264,7 @@ def merge(self) -> "PullRequest":
264264

265265
def get_statuses(self) -> List[CommitFlag]:
266266
self.__update()
267-
return self.project.get_commit_statuses(self._raw_pr["commit_stop"])
267+
return self.target_project.get_commit_statuses(self._raw_pr["commit_stop"])
268268

269269
def set_flag(
270270
self,

tests/integration/factory/__init__.py

Whitespace-only changes.
File renamed without changes.

tests/integration/github/test_data/test_app/tests.integration.github.test_app.GithubTests.test_get_project.yaml

+323-330
Large diffs are not rendered by default.

tests/integration/github/test_data/test_app/tests.integration.github.test_app.GithubTests.test_get_project_having_key_as_path.yaml

+169-170
Large diffs are not rendered by default.

tests/integration/github/test_data/test_app/tests.integration.github.test_app.GithubTests.test_github_proj_no_app_creds.yaml

+49-51
Original file line numberDiff line numberDiff line change
@@ -6,54 +6,52 @@ requests.sessions:
66
send:
77
GET:
88
https://api.github.com/repos/packit/packit/installation:
9-
- metadata:
10-
latency: 0.4730544090270996
11-
module_call_list:
12-
- unittest.case
13-
- requre.online_replacing
14-
- tests.integration.github.test_app
15-
- ogr.services.github.project
16-
- ogr.services.github.service
17-
- ogr.services.github.auth_providers.github_app
18-
- github.MainClass
19-
- requests.api
20-
- requests.sessions
21-
- requre.objects
22-
- requre.cassette
23-
- requests.sessions
24-
- send
25-
output:
26-
__store_indicator: 2
27-
_content:
28-
documentation_url: https://docs.github.com/rest
29-
message: A JSON web token could not be decoded
30-
_next: null
31-
elapsed: 0.2
32-
encoding: utf-8
33-
headers:
34-
Access-Control-Allow-Origin: "*"
35-
Access-Control-Expose-Headers:
36-
ETag, Link, Location, Retry-After, X-GitHub-OTP,
37-
X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes,
38-
X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation,
39-
Sunset
40-
Content-Length: "102"
41-
Content-Security-Policy:
42-
default-src 'self';script-src 'self' 'nonce-YqLDC0BS8d7iY8mKO7VtBbIne'
43-
https://apps.fedoraproject.org; style-src 'self' 'nonce-YqLDC0BS8d7iY8mKO7VtBbIne';
44-
object-src 'none';base-uri 'self';img-src 'self' https:;
45-
Content-Type: application/json; charset=utf-8
46-
Date: Fri, 01 Nov 2019 13-36-03 GMT
47-
Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
48-
Server: GitHub.com
49-
Status: 401 Unauthorized
50-
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
51-
Vary: Accept-Encoding, Accept, X-Requested-With
52-
X-Content-Type-Options: nosniff
53-
X-Frame-Options: deny
54-
X-GitHub-Media-Type: github.v3; param=machine-man-preview; format=json
55-
X-GitHub-Request-Id: 18FB:AA1A:99616C4:B8092CB:5CC15425
56-
X-XSS-Protection: 1; mode=block
57-
raw: !!binary ""
58-
reason: Unauthorized
59-
status_code: 401
9+
- metadata:
10+
latency: 0.4730544090270996
11+
module_call_list:
12+
- unittest.case
13+
- requre.online_replacing
14+
- tests.integration.github.test_app
15+
- ogr.services.github.project
16+
- ogr.services.github.service
17+
- ogr.services.github.auth_providers.github_app
18+
- github.MainClass
19+
- requests.api
20+
- requests.sessions
21+
- requre.objects
22+
- requre.cassette
23+
- requests.sessions
24+
- send
25+
output:
26+
__store_indicator: 2
27+
_content:
28+
documentation_url: https://docs.github.com/rest
29+
message: A JSON web token could not be decoded
30+
_next: null
31+
elapsed: 0.2
32+
encoding: utf-8
33+
headers:
34+
Access-Control-Allow-Origin: '*'
35+
Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP,
36+
X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes,
37+
X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation,
38+
Sunset
39+
Content-Length: '102'
40+
Content-Security-Policy: default-src 'self';script-src 'self' 'nonce-YqLDC0BS8d7iY8mKO7VtBbIne'
41+
https://apps.fedoraproject.org; style-src 'self' 'nonce-YqLDC0BS8d7iY8mKO7VtBbIne';
42+
object-src 'none';base-uri 'self';img-src 'self' https:;
43+
Content-Type: application/json; charset=utf-8
44+
Date: Fri, 01 Nov 2019 13-36-03 GMT
45+
Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
46+
Server: GitHub.com
47+
Status: 401 Unauthorized
48+
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
49+
Vary: Accept-Encoding, Accept, X-Requested-With
50+
X-Content-Type-Options: nosniff
51+
X-Frame-Options: deny
52+
X-GitHub-Media-Type: github.v3; param=machine-man-preview; format=json
53+
X-GitHub-Request-Id: 18FB:AA1A:99616C4:B8092CB:5CC15425
54+
X-XSS-Protection: 1; mode=block
55+
raw: !!binary ""
56+
reason: Unauthorized
57+
status_code: 401

0 commit comments

Comments
 (0)