(t *testing.T)
| 39 | } |
| 40 | |
| 41 | func 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 | |
| 79 | func TestMakeScopesWithEmptyEntities(t *testing.T) { |
| 80 | mockBitbucketPlugin(t) |
nothing calls this directly
no test coverage detected