automatons_github/testing/
check_suite.rs

1use mockito::{mock, Mock};
2
3pub fn mock_list_check_suites() -> Mock {
4    mock("GET", "/repos/github/hello-world/commits/d6fde92930d4715a2b49857d24b940956b26d2d3/check-suites")
5        .with_status(200)
6        .with_body(r#"
7            {
8              "total_count": 1,
9              "check_suites": [
10                {
11                  "id": 5,
12                  "node_id": "MDEwOkNoZWNrU3VpdGU1",
13                  "head_branch": "master",
14                  "head_sha": "d6fde92930d4715a2b49857d24b940956b26d2d3",
15                  "status": "completed",
16                  "conclusion": "neutral",
17                  "url": "https://api.github.com/repos/github/hello-world/check-suites/5",
18                  "before": "146e867f55c26428e5f9fade55a9bbf5e95a7912",
19                  "after": "d6fde92930d4715a2b49857d24b940956b26d2d3",
20                  "pull_requests": [],
21                  "app": {
22                    "id": 1,
23                    "slug": "octoapp",
24                    "node_id": "MDExOkludGVncmF0aW9uMQ==",
25                    "owner": {
26                      "login": "github",
27                      "id": 1,
28                      "node_id": "MDEyOk9yZ2FuaXphdGlvbjE=",
29                      "url": "https://api.github.com/orgs/github",
30                      "repos_url": "https://api.github.com/orgs/github/repos",
31                      "events_url": "https://api.github.com/orgs/github/events",
32                      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
33                      "gravatar_id": "",
34                      "html_url": "https://github.com/octocat",
35                      "followers_url": "https://api.github.com/users/octocat/followers",
36                      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
37                      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
38                      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
39                      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
40                      "organizations_url": "https://api.github.com/users/octocat/orgs",
41                      "received_events_url": "https://api.github.com/users/octocat/received_events",
42                      "type": "User",
43                      "site_admin": true
44                    },
45                    "name": "Octocat App",
46                    "description": "",
47                    "external_url": "https://example.com",
48                    "html_url": "https://github.com/apps/octoapp",
49                    "created_at": "2017-07-08T16:18:44-04:00",
50                    "updated_at": "2017-07-08T16:18:44-04:00",
51                    "permissions": {
52                      "metadata": "read",
53                      "contents": "read",
54                      "issues": "write",
55                      "single_file": "write"
56                    },
57                    "events": [
58                      "push",
59                      "pull_request"
60                    ]
61                  },
62                  "repository": {
63                    "id": 1296269,
64                    "node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
65                    "name": "Hello-World",
66                    "full_name": "octocat/Hello-World",
67                    "owner": {
68                      "login": "octocat",
69                      "id": 1,
70                      "node_id": "MDQ6VXNlcjE=",
71                      "avatar_url": "https://github.com/images/error/octocat_happy.gif",
72                      "gravatar_id": "",
73                      "url": "https://api.github.com/users/octocat",
74                      "html_url": "https://github.com/octocat",
75                      "followers_url": "https://api.github.com/users/octocat/followers",
76                      "following_url": "https://api.github.com/users/octocat/following{/other_user}",
77                      "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
78                      "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
79                      "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
80                      "organizations_url": "https://api.github.com/users/octocat/orgs",
81                      "repos_url": "https://api.github.com/users/octocat/repos",
82                      "events_url": "https://api.github.com/users/octocat/events{/privacy}",
83                      "received_events_url": "https://api.github.com/users/octocat/received_events",
84                      "type": "User",
85                      "site_admin": false
86                    },
87                    "private": false,
88                    "html_url": "https://github.com/octocat/Hello-World",
89                    "description": "This your first repo!",
90                    "fork": false,
91                    "url": "https://api.github.com/repos/octocat/Hello-World",
92                    "archive_url": "https://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
93                    "assignees_url": "https://api.github.com/repos/octocat/Hello-World/assignees{/user}",
94                    "blobs_url": "https://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
95                    "branches_url": "https://api.github.com/repos/octocat/Hello-World/branches{/branch}",
96                    "collaborators_url": "https://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
97                    "comments_url": "https://api.github.com/repos/octocat/Hello-World/comments{/number}",
98                    "commits_url": "https://api.github.com/repos/octocat/Hello-World/commits{/sha}",
99                    "compare_url": "https://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
100                    "contents_url": "https://api.github.com/repos/octocat/Hello-World/contents/{+path}",
101                    "contributors_url": "https://api.github.com/repos/octocat/Hello-World/contributors",
102                    "deployments_url": "https://api.github.com/repos/octocat/Hello-World/deployments",
103                    "downloads_url": "https://api.github.com/repos/octocat/Hello-World/downloads",
104                    "events_url": "https://api.github.com/repos/octocat/Hello-World/events",
105                    "forks_url": "https://api.github.com/repos/octocat/Hello-World/forks",
106                    "git_commits_url": "https://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
107                    "git_refs_url": "https://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
108                    "git_tags_url": "https://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
109                    "git_url": "git:github.com/octocat/Hello-World.git",
110                    "issue_comment_url": "https://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
111                    "issue_events_url": "https://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
112                    "issues_url": "https://api.github.com/repos/octocat/Hello-World/issues{/number}",
113                    "keys_url": "https://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
114                    "labels_url": "https://api.github.com/repos/octocat/Hello-World/labels{/name}",
115                    "languages_url": "https://api.github.com/repos/octocat/Hello-World/languages",
116                    "merges_url": "https://api.github.com/repos/octocat/Hello-World/merges",
117                    "milestones_url": "https://api.github.com/repos/octocat/Hello-World/milestones{/number}",
118                    "notifications_url": "https://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}",
119                    "pulls_url": "https://api.github.com/repos/octocat/Hello-World/pulls{/number}",
120                    "releases_url": "https://api.github.com/repos/octocat/Hello-World/releases{/id}",
121                    "ssh_url": "git@github.com:octocat/Hello-World.git",
122                    "stargazers_url": "https://api.github.com/repos/octocat/Hello-World/stargazers",
123                    "statuses_url": "https://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
124                    "subscribers_url": "https://api.github.com/repos/octocat/Hello-World/subscribers",
125                    "subscription_url": "https://api.github.com/repos/octocat/Hello-World/subscription",
126                    "tags_url": "https://api.github.com/repos/octocat/Hello-World/tags",
127                    "teams_url": "https://api.github.com/repos/octocat/Hello-World/teams",
128                    "trees_url": "https://api.github.com/repos/octocat/Hello-World/git/trees{/sha}",
129                    "clone_url": "https://github.com/octocat/Hello-World.git",
130                    "mirror_url": "git:git.example.com/octocat/Hello-World",
131                    "hooks_url": "https://api.github.com/repos/octocat/Hello-World/hooks",
132                    "svn_url": "https://svn.github.com/octocat/Hello-World",
133                    "homepage": "https://github.com",
134                    "language": null,
135                    "forks_count": 9,
136                    "stargazers_count": 80,
137                    "watchers_count": 80,
138                    "size": 108,
139                    "default_branch": "master",
140                    "open_issues_count": 0,
141                    "is_template": true,
142                    "topics": [
143                      "octocat",
144                      "atom",
145                      "electron",
146                      "api"
147                    ],
148                    "has_issues": true,
149                    "has_projects": true,
150                    "has_wiki": true,
151                    "has_pages": false,
152                    "has_downloads": true,
153                    "archived": false,
154                    "disabled": false,
155                    "visibility": "public",
156                    "pushed_at": "2011-01-26T19:06:43Z",
157                    "created_at": "2011-01-26T19:01:12Z",
158                    "updated_at": "2011-01-26T19:14:43Z",
159                    "permissions": {
160                      "admin": false,
161                      "push": false,
162                      "pull": true
163                    },
164                    "temp_clone_token": "ABTLWHOULUVAXGTRYU7OC2876QJ2O",
165                    "delete_branch_on_merge": true,
166                    "subscribers_count": 42,
167                    "network_count": 0
168                  },
169                  "created_at": "2011-01-26T19:01:12Z",
170                  "updated_at": "2011-01-26T19:14:43Z",
171                  "head_commit": {
172                    "id": "7fd1a60b01f91b314f59955a4e4d4e80d8edf11d",
173                    "tree_id": "7fd1a60b01f91b314f59955a4e4d4e80d8edf11d",
174                    "message": "Merge pull request #6 from Spaceghost/patch-1\n\nNew line at end of file.",
175                    "timestamp": "2016-10-10T00:00:00Z",
176                    "author": {
177                      "name": "The Octocat",
178                      "email": "octocat@nowhere.com"
179                    },
180                    "committer": {
181                      "name": "The Octocat",
182                      "email": "octocat@nowhere.com"
183                    }
184                  },
185                  "latest_check_runs_count": 1,
186                  "check_runs_url": "https://api.github.com/repos/octocat/Hello-World/check-suites/5/check-runs"
187                }
188              ]
189            }
190        "#).create()
191}