MCPcopy Create free account
hub / github.com/apache/devlake / TestMakeScopes

Function TestMakeScopes

backend/plugins/gitlab/api/blueprint_V200_test.go:43–73  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

41}
42
43func TestMakeScopes(t *testing.T) {
44 mockGitlabPlugin(t)
45
46 const connectionId = 1
47 const gitlabProjectId = 37
48 const expectDomainScopeId = "gitlab:GitlabProject:1:37"
49
50 actualScopes, err := makeScopeV200(
51 connectionId,
52 []*srvhelper.ScopeDetail[models.GitlabProject, models.GitlabScopeConfig]{
53 {
54 Scope: models.GitlabProject{
55 Scope: common.Scope{
56 ConnectionId: connectionId,
57 },
58 GitlabId: gitlabProjectId,
59 },
60 ScopeConfig: &models.GitlabScopeConfig{
61 ScopeConfig: common.ScopeConfig{
62 Entities: []string{plugin.DOMAIN_TYPE_CODE, plugin.DOMAIN_TYPE_TICKET, plugin.DOMAIN_TYPE_CICD},
63 },
64 },
65 },
66 },
67 )
68 assert.Nil(t, err)
69 assert.Equal(t, 3, len(actualScopes))
70 assert.Equal(t, actualScopes[0].ScopeId(), expectDomainScopeId)
71 assert.Equal(t, actualScopes[1].ScopeId(), expectDomainScopeId)
72 assert.Equal(t, actualScopes[2].ScopeId(), expectDomainScopeId)
73}
74
75func TestMakeScopesWithEmptyEntities(t *testing.T) {
76 mockGitlabPlugin(t)

Callers

nothing calls this directly

Calls 3

mockGitlabPluginFunction · 0.85
makeScopeV200Function · 0.70
ScopeIdMethod · 0.65

Tested by

no test coverage detected