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

Function TestMakeScopes

backend/plugins/bitbucket/api/blueprint_v200_test.go:41–77  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

39}
40
41func TestMakeScopes(t *testing.T) {
42 mockBitbucketPlugin(t)
43
44 const connectionId uint64 = 1
45 const bitbucketId = "owner/repo"
46 const expectDomainScopeId = "bitbucket:BitbucketRepo:1:owner/repo"
47
48 actualScopes, err := makeScopesV200(
49 []*srvhelper.ScopeDetail[models.BitbucketRepo, models.BitbucketScopeConfig]{
50 {
51 Scope: models.BitbucketRepo{
52 Scope: common.Scope{
53 ConnectionId: connectionId,
54 },
55 BitbucketId: bitbucketId,
56 },
57 ScopeConfig: &models.BitbucketScopeConfig{
58 ScopeConfig: common.ScopeConfig{
59 Entities: []string{plugin.DOMAIN_TYPE_CODE, plugin.DOMAIN_TYPE_TICKET, plugin.DOMAIN_TYPE_CICD},
60 },
61 },
62 },
63 },
64 &models.BitbucketConnection{
65 BaseConnection: api.BaseConnection{
66 Model: common.Model{
67 ID: connectionId,
68 },
69 },
70 },
71 )
72 assert.Nil(t, err)
73 assert.Equal(t, 3, len(actualScopes))
74 assert.Equal(t, expectDomainScopeId, actualScopes[0].ScopeId())
75 assert.Equal(t, expectDomainScopeId, actualScopes[1].ScopeId())
76 assert.Equal(t, expectDomainScopeId, actualScopes[2].ScopeId())
77}
78
79func TestMakeScopesWithEmptyEntities(t *testing.T) {
80 mockBitbucketPlugin(t)

Callers

nothing calls this directly

Calls 3

mockBitbucketPluginFunction · 0.85
makeScopesV200Function · 0.70
ScopeIdMethod · 0.65

Tested by

no test coverage detected