forked from jfrog/frogbot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure_test.go
44 lines (37 loc) · 1.59 KB
/
azure_test.go
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
33
34
35
36
37
38
39
40
41
42
43
44
package main
import (
"github.com/jfrog/frogbot/v2/utils"
"github.com/jfrog/froggit-go/vcsclient"
"github.com/jfrog/froggit-go/vcsutils"
"github.com/stretchr/testify/assert"
"testing"
)
const (
azureIntegrationTokenEnv = "FROGBOT_TESTS_AZURE_TOKEN"
azureApiEndpoint = "https://dev.azure.com/frogbot-test"
azureGitCloneUrl = "https://[email protected]/frogbot-test/integration/_git/integration"
)
func buildAzureReposClient(t *testing.T, azureToken string) vcsclient.VcsClient {
azureClient, err := vcsclient.NewClientBuilder(vcsutils.AzureRepos).Project(repoName).ApiEndpoint(azureApiEndpoint).Token(azureToken).Build()
assert.NoError(t, err)
return azureClient
}
func buildAzureReposIntegrationTestDetails(t *testing.T) *IntegrationTestDetails {
integrationRepoToken := getIntegrationToken(t, azureIntegrationTokenEnv)
testDetails := NewIntegrationTestDetails(integrationRepoToken, string(utils.AzureRepos), azureGitCloneUrl, "frogbot-test")
testDetails.ApiEndpoint = azureApiEndpoint
return testDetails
}
func azureReposTestsInit(t *testing.T) (vcsclient.VcsClient, *IntegrationTestDetails) {
testDetails := buildAzureReposIntegrationTestDetails(t)
azureClient := buildAzureReposClient(t, testDetails.GitToken)
return azureClient, testDetails
}
func TestAzureRepos_ScanPullRequestIntegration(t *testing.T) {
azureClient, testDetails := azureReposTestsInit(t)
runScanPullRequestCmd(t, azureClient, testDetails)
}
func TestAzureRepos_ScanRepositoryIntegration(t *testing.T) {
azureClient, testDetails := azureReposTestsInit(t)
runScanRepositoryCmd(t, azureClient, testDetails)
}