Skip to content

Commit 7361233

Browse files
authored
Fix acctests (#23)
* Formatting * Fix tests
1 parent 5bc995c commit 7361233

File tree

6 files changed

+21
-21
lines changed

6 files changed

+21
-21
lines changed

client/client.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ import (
1111

1212
// Client token, host, htpp.Client
1313
type Client struct {
14-
Token string
14+
Token string
1515
TokenHeader string
16-
Host string
17-
Client *http.Client
16+
Host string
17+
Client *http.Client
1818
}
1919

2020
// RequestOptions path, method, etc
@@ -34,10 +34,10 @@ func NewClient(hostname string, token string, tokenHeader string) *Client {
3434
tokenHeader = "Authorization"
3535
}
3636
return &Client{
37-
Host: hostname,
38-
Token: token,
37+
Host: hostname,
38+
Token: token,
3939
TokenHeader: tokenHeader,
40-
Client: &http.Client{},
40+
Client: &http.Client{},
4141
}
4242

4343
}
@@ -55,9 +55,9 @@ func (client *Client) RequestAPI(opt *RequestOptions) ([]byte, error) {
5555

5656
tokenHeader := client.TokenHeader
5757
if tokenHeader == "" {
58-
tokenHeader = "Authorization"
58+
tokenHeader = "Authorization"
5959
}
60-
request.Header.Set(tokenHeader, client.Token)
60+
request.Header.Set(tokenHeader, client.Token)
6161
request.Header.Set("Content-Type", "application/json; charset=utf-8")
6262

6363
resp, err := client.Client.Do(request)

client/user.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ func (client *Client) AddPendingUser(user *NewUser) (*User, error) {
119119

120120
// AddUserToTeamByAdmin - adds user to team with swich account
121121
func (client *Client) AddUserToTeamByAdmin(userID string, accountID string, team string) error {
122-
// get first accountAdmin and its token
122+
// get first accountAdmin and its token
123123
account, err := client.GetAccountByID(accountID)
124124
if err != nil {
125125
return err
@@ -131,9 +131,9 @@ func (client *Client) AddUserToTeamByAdmin(userID string, accountID string, team
131131
accountAdminUserID := account.Admins[0]
132132
accountAdminToken, err := client.GetXAccessToken(accountAdminUserID, accountID)
133133
if err != nil {
134-
return err
134+
return err
135135
}
136-
// new Client for accountAdmin
136+
// new Client for accountAdmin
137137
accountAdminClient := NewClient(client.Host, accountAdminToken, "x-access-token")
138138
usersTeam, err := accountAdminClient.GetTeamByName(team)
139139
if err != nil {
@@ -152,7 +152,7 @@ func (client *Client) AddUserToTeamByAdmin(userID string, accountID string, team
152152
}
153153

154154
err = accountAdminClient.AddUserToTeam(usersTeam.ID, userID)
155-
155+
156156
return err
157157
}
158158

@@ -245,7 +245,7 @@ func (client *Client) GetUserByID(userId string) (*User, error) {
245245
}
246246
}
247247

248-
return nil, errors.New(fmt.Sprint("[ERROR] User with ID %s wasn't found.", userId))
248+
return nil, errors.New(fmt.Sprintf("[ERROR] User with ID %s wasn't found.", userId))
249249
}
250250

251251
func (client *Client) DeleteUser(userName string) error {

codefresh/resource_api_key.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ func resourceApiKey() *schema.Resource {
3030
Required: true,
3131
},
3232
"token": {
33-
Type: schema.TypeString,
34-
Computed: true,
33+
Type: schema.TypeString,
34+
Computed: true,
3535
Sensitive: true,
3636
},
3737
"scopes": {

codefresh/resource_pipeline_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ func TestAccCodefreshPipeline_Tags(t *testing.T) {
5353
Config: testAccCodefreshPipelineBasicConfigTags(name, "codefresh-contrib/react-sample-app", "./codefresh.yml", "master", "git", "testTag1", "testTag2"),
5454
Check: resource.ComposeTestCheckFunc(
5555
testAccCheckCodefreshPipelineExists(resourceName),
56-
resource.TestCheckResourceAttr(resourceName, "tags.3247715412", "testTag2"),
57-
resource.TestCheckResourceAttr(resourceName, "tags.3938019223", "testTag1"),
56+
resource.TestCheckResourceAttr(resourceName, "tags.1", "testTag2"),
57+
resource.TestCheckResourceAttr(resourceName, "tags.0", "testTag1"),
5858
),
5959
},
6060
{
@@ -103,7 +103,7 @@ func TestAccCodefreshPipeline_Variables(t *testing.T) {
103103
func TestAccCodefreshPipeline_RuntimeEnvironment(t *testing.T) {
104104
name := pipelineNamePrefix + acctest.RandString(10)
105105
resourceName := "codefresh_pipeline.test"
106-
runtimeName := "system/codefresh-inc-default"
106+
runtimeName := "system/default"
107107

108108
resource.ParallelTest(t, resource.TestCase{
109109
PreCheck: func() { testAccPreCheck(t) },

codefresh/resource_project_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ func TestAccCodefreshProject_Tags(t *testing.T) {
5050
Config: testAccCodefreshProjectBasicConfigTags(name, "testTag1", "testTag2"),
5151
Check: resource.ComposeTestCheckFunc(
5252
testAccCheckCodefreshProjectExists(resourceName),
53-
resource.TestCheckResourceAttr(resourceName, "tags.3247715412", "testTag2"),
54-
resource.TestCheckResourceAttr(resourceName, "tags.3938019223", "testTag1"),
53+
resource.TestCheckResourceAttr(resourceName, "tags.1", "testTag2"),
54+
resource.TestCheckResourceAttr(resourceName, "tags.0", "testTag1"),
5555
),
5656
},
5757
{

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
func main() {
1313
debugMode := (os.Getenv("CODEFRESH_PLUGIN_DEBUG") != "")
1414
// for terraform 0.13: export CODEFRESH_PLUGIN_ADDR="codefresh.io/app/codefresh"
15-
providerAddr := os.Getenv("CODEFRESH_PLUGIN_ADDR")
15+
providerAddr := os.Getenv("CODEFRESH_PLUGIN_ADDR")
1616
if providerAddr == "" {
1717
providerAddr = "registry.terraform.io/-/codefresh"
1818
}

0 commit comments

Comments
 (0)