-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathmanual_tests.py
More file actions
97 lines (82 loc) · 2.6 KB
/
manual_tests.py
File metadata and controls
97 lines (82 loc) · 2.6 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
import query
from requests import post
from pprint import pprint
def test1():
print("Enter an access token: ", end="")
auth = input()
headers = {
"Authorization": "token " + auth,
"Accept": "application/vnd.github+json",
}
preliminary_query = """
{
repository(name: "flutter", owner: "flutter") {
issue(number: 1831) {
comments(first:100) {
edges {
node {
author {
login
canReceiveOrganizationEmailsWhenNotificationsRestricted
}
bodyText
createdAt
}
}
pageInfo {
endCursor
}
}
}
}
}
"""
request = post("https://api.github.com/graphql", json={"query": preliminary_query}, headers=headers)
trimmed_request = request.json()["data"]["repository"]["issue"]["comments"]
trimmed_request["edges"] += query.get_other_comments(1831, trimmed_request["pageInfo"]["endCursor"],
"flutter", "flutter", "issue", headers)
pprint(trimmed_request)
print(len(trimmed_request["edges"]))
def test2():
print("Enter an access token: ", end="")
auth = input()
headers = {
"Authorization": "token " + auth,
"Accept": "application/vnd.github+json",
}
query = """
{
repository(name: "chromium", owner: "chromium") {
pullRequest(number: 134) {
comments(first:100) {
edges {
node {
author {
login
__typename
}
bodyText
createdAt
}
}
pageInfo {
endCursor
}
}
}
}
}
"""
request = post("https://api.github.com/graphql", json={"query": query}, headers=headers)
pprint(request.json())
trimmed_request = request.json()["data"]["repository"]["pullRequest"]
pprint(trimmed_request)
if __name__ == "__main__":
print("Which test do you want to run?")
ans = input()
if ans == "1":
test1()
elif ans == "2":
test2()
else:
print("no test with that number")