FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
sourcegraph/dev/codehost_testing/user.go at main · drdaliang/sourcegraph · GitHub
drdaliang
/
sourcegraph
Public
forked from
sourcegraph/sourcegraph-public-snapshot
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
Code
Pull requests
1
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
sourcegraph
/
dev
/
codehost_testing
/
user.go
Copy path
More file actions
More file actions
Latest commit
History
History
History
32 lines (26 loc) · 896 Bytes
Breadcrumbs
sourcegraph
/
dev
/
codehost_testing
/
user.go
Copy path
File metadata and controls
32 lines (26 loc) · 896 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
package
codehost_testing
import
(
"context"
"github.com/google/go-github/v55/github"
"github.com/sourcegraph/sourcegraph/lib/errors"
)
// User represents a GitHub user in the scenario.
type
User
struct
{
s
*
GitHubScenario
name
string
}
// Get returns the corresponding GitHub user object that was created by the `CreateUser`
//
// This method will only return a User if the Scenario that created it has been applied otherwise
// it will panic.
func
(
u
*
User
)
Get
(
ctx
context.
Context
) (
*
github.
User
,
error
) {
if
u
.
s
.
IsApplied
() {
return
u
.
get
(
ctx
)
}
return
nil
,
errors
.
New
(
"cannot retrieve user before scenario is applied"
)
}
// get retrieves the GitHub user without panicking if not applied. It is meant as an
// internal helper method while actions are getting applied.
func
(
u
*
User
)
get
(
ctx
context.
Context
) (
*
github.
User
,
error
) {
return
u
.
s
.
client
.
GetUser
(
ctx
,
u
.
name
)
}
Back
|
FazBrowse Home
|
New Git URL