-
Notifications
You must be signed in to change notification settings - Fork 3
/
in_memory.ex
112 lines (105 loc) · 4.5 KB
/
in_memory.ex
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
defmodule AppWeb.GithubAPI.InMemory do
@moduledoc """
mock of github api functions for tests
"""
@comment %{
"author_association" => "NONE",
"body" => ":warning: @SimonLab, the pull request has a **merge conflict**.\nPlease resolve the conflict and reassign when ready :+1:\nThanks!\n\nAny questions, complaints, feedback, contributions?\n[![Discuss](https://img.shields.io/badge/discuss-with%20us-brightgreen.svg?style=flat)](https://github.com/dwyl/dwylbot/issues \"Discuss your ideas/suggestions with us!\")\nIf you prefer, you can also send us anonymous feedback: https://dwyl-feedback.herokuapp.com/feedback/new\n",
"created_at" => "2017-06-26T13:21:23Z",
"html_url" => "https://github.com/SimonLab/github_app/pull/23#issuecomment-311057291",
"id" => 311057291,
"issue_url" => "https://api.github.com/repos/SimonLab/github_app/issues/18",
"performed_via_github_app" => nil,
"updated_at" => "2017-06-26T13:21:23Z",
"url" => "https://api.github.com/repos/SimonLab/github_app/issues/comments/311057291",
"user" => %{
"avatar_url" => "https://avatars2.githubusercontent.com/in/2666?v=4",
"events_url" => "https://api.github.com/users/simonlabapp%5Bbot%5D/events{/privacy}",
"followers_url" => "https://api.github.com/users/simonlabapp%5Bbot%5D/followers",
"following_url" => "https://api.github.com/users/simonlabapp%5Bbot%5D/following{/other_user}",
"gists_url" => "https://api.github.com/users/simonlabapp%5Bbot%5D/gists{/gist_id}",
"gravatar_id" => "",
"html_url" => "https://github.com/apps/simonlabapp",
"id" => 29067442,
"login" => "simonlabapp[bot]",
"organizations_url" => "https://api.github.com/users/simonlabapp%5Bbot%5D/orgs",
}
}
@issue %{
"assignee" => nil,
"assignees" => [],
"author_association" => "OWNER",
"body" => "a",
"closed_at" => "2017-06-16T14:55:39Z",
"comments" => [@comment],
"comments_url" => "https://api.github.com/repos/SimonLab/github_app/issues/18/comments",
"created_at" => "2017-06-16T14:52:18Z",
"events_url" => "https://api.github.com/repos/SimonLab/github_app/issues/18/events",
"html_url" => "https://github.com/SimonLab/github_app/pull/18",
"id" => 236506221,
"labels" => [],
"labels_url" => "https://api.github.com/repos/SimonLab/github_app/issues/18/labels{/name}",
"locked" => false,
"milestone" => nil,
"number" => 18,
"performed_via_github_app" => nil,
"repository_url" => "https://api.github.com/repos/SimonLab/github_app",
"state" => "closed",
"title" => "aaaaaaa",
"updated_at" => "2017-06-16T14:55:39Z",
"url" => "https://api.github.com/repos/SimonLab/github_app/issues/18",
"user" => %{
"login" => "bob",
"id" => 1,
"html_url" => "/bob",
"avatar_url" => "https://avatars2.githubusercontent.com/u/6057298?v=4",
"events_url" => "https://api.github.com/users/SimonLab/events{/privacy}",
}
}
@issue2 %{
"assignee" => nil,
"assignees" => [],
"author_association" => "OWNER",
"body" => "a",
"closed_at" => "2017-06-16T14:55:39Z",
"comments" => [@comment],
"comments_url" => "https://api.github.com/repos/SimonLab/github_app/issues/18/comments",
"created_at" => "2017-06-16T14:52:18Z",
"events_url" => "https://api.github.com/repos/SimonLab/github_app/issues/18/events",
"html_url" => "https://github.com/SimonLab/github_app/pull/18",
"id" => 836506221,
"labels" => [],
"labels_url" => "https://api.github.com/repos/SimonLab/github_app/issues/18/labels{/name}",
"locked" => false,
"milestone" => nil,
"number" => 18,
"performed_via_github_app" => nil,
"repository_url" => "https://api.github.com/repos/SimonLab/github_app",
"state" => "closed",
"title" => "aaaaaaa",
"updated_at" => "2017-06-16T14:55:39Z",
"url" => "https://api.github.com/repos/SimonLab/github_app/issues/18",
"user" => %{
"login" => "bob",
"id" => 1,
"html_url" => "/bob",
"avatar_url" => "https://avatars2.githubusercontent.com/u/6057298?v=4",
"events_url" => "https://api.github.com/users/SimonLab/events{/privacy}",
}
}
def get_installation_token(_installation_id) do
"token_installation_1234"
end
def get_issues(_token, _payload, _page, _issues) do
[@issue]
end
def get_comments(_token, _repo, _page, _comments) do
[@comment]
end
def add_meta_table(_repo_name, _issue_id, _content, _token) do
:ok
end
def get_issue(_token, _repo, _issue_number) do
@issue2
end
end