Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Clutch
Commits
15082c09
Unverified
Commit
15082c09
authored
3 years ago
by
Shawna Monero
Committed by
GitHub
3 years ago
Browse files
Options
Download
Email Patches
Plain Diff
backend: github service: add User object to response (#1626)
parent
539c68a1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
backend/service/github/github.go
+4
-2
backend/service/github/github.go
backend/service/github/github_test.go
+18
-12
backend/service/github/github_test.go
with
22 additions
and
14 deletions
+22
-14
backend/service/github/github.go
+
4
-
2
View file @
15082c09
...
...
@@ -364,7 +364,7 @@ func (s *svc) CompareCommits(ctx context.Context, ref *RemoteRef, compareSHA str
type
Commit
struct
{
Files
[]
*
githubv3
.
CommitFile
Message
string
Author
*
githubv3
.
CommitAutho
r
Author
*
githubv3
.
Use
r
}
func
(
s
*
svc
)
GetCommit
(
ctx
context
.
Context
,
ref
*
RemoteRef
)
(
*
Commit
,
error
)
{
...
...
@@ -372,10 +372,12 @@ func (s *svc) GetCommit(ctx context.Context, ref *RemoteRef) (*Commit, error) {
if
err
!=
nil
{
return
nil
,
err
}
// Currently we are using the Author (Github) rather than commit Author (Git)
return
&
Commit
{
Files
:
commit
.
Files
,
Message
:
commit
.
GetCommit
()
.
GetMessage
(),
Author
:
commit
.
GetCommit
()
.
GetAuthor
(),
Author
:
commit
.
GetAuthor
(),
},
nil
}
...
...
This diff is collapsed.
Click to expand it.
backend/service/github/github_test.go
+
18
-
12
View file @
15082c09
...
...
@@ -364,12 +364,14 @@ func TestCompareCommits(t *testing.T) {
}
var
getCommitsTests
=
[]
struct
{
name
string
errorText
string
mockRepo
*
mockRepositories
file
string
message
string
authorLogin
string
name
string
errorText
string
mockRepo
*
mockRepositories
file
string
message
string
authorLogin
string
authorAvatarURL
string
authorID
int64
}{
{
name
:
"v3 error"
,
...
...
@@ -377,11 +379,12 @@ var getCommitsTests = []struct {
errorText
:
"we've had a problem"
,
},
{
name
:
"happy path"
,
mockRepo
:
&
mockRepositories
{},
file
:
"testfile.go"
,
message
:
"committing some changes (#1)"
,
authorLogin
:
"foobar"
,
name
:
"happy path"
,
mockRepo
:
&
mockRepositories
{},
file
:
"testfile.go"
,
message
:
"committing some changes (#1)"
,
authorAvatarURL
:
"https://foo.bar/baz.png"
,
authorID
:
1234
,
},
}
...
...
@@ -415,7 +418,10 @@ func TestGetCommit(t *testing.T) {
}
a
.
Equal
(
tt
.
file
,
*
commit
.
Files
[
0
]
.
Filename
)
a
.
Equal
(
tt
.
message
,
commit
.
Message
)
a
.
Equal
(
tt
.
authorLogin
,
*
commit
.
Author
.
Login
)
if
commit
.
Author
!=
nil
{
a
.
Equal
(
tt
.
authorAvatarURL
,
*
commit
.
Author
.
AvatarURL
)
a
.
Equal
(
tt
.
authorID
,
*
commit
.
Author
.
ID
)
}
a
.
Nil
(
err
)
})
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help