Skip to content

Commit fcb84a8

Browse files
committed
review changes 5 (improve test description)
Signed-off-by: Mauritz Uphoff <mauritz.uphoff@stackit.cloud>
1 parent 513312f commit fcb84a8

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

stackit/internal/services/access_token/ephemeral_resource_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func TestGetAccessToken(t *testing.T) {
8888
expected string
8989
}{
9090
{
91-
description: "should_return_token_when_service_account_key_passed_by_value",
91+
description: "should return token when service account key passed by value",
9292
cfgFactory: func() *config.Configuration {
9393
return &config.Configuration{
9494
ServiceAccountKey: testServiceAccountKey,
@@ -100,7 +100,7 @@ func TestGetAccessToken(t *testing.T) {
100100
expected: "mock_access_token",
101101
},
102102
{
103-
description: "should_return_token_when_service_account_key_is_loaded_from_file_path",
103+
description: "should return token when service account key is loaded from file path",
104104
cfgFactory: func() *config.Configuration {
105105
return &config.Configuration{
106106
ServiceAccountKeyPath: "testdata/service_account.json",
@@ -112,7 +112,7 @@ func TestGetAccessToken(t *testing.T) {
112112
expected: "mock_access_token",
113113
},
114114
{
115-
description: "should_fail_when_private_key_is_invalid",
115+
description: "should fail when private key is invalid",
116116
cfgFactory: func() *config.Configuration {
117117
return &config.Configuration{
118118
ServiceAccountKey: "invalid-json",
@@ -124,7 +124,7 @@ func TestGetAccessToken(t *testing.T) {
124124
expected: "",
125125
},
126126
{
127-
description: "should_return_token_when_service_account_key_is_set_via_env",
127+
description: "should return token when service account key is set via env",
128128
setupEnv: func() {
129129
_ = os.Setenv("STACKIT_SERVICE_ACCOUNT_KEY", testServiceAccountKey)
130130
},
@@ -141,7 +141,7 @@ func TestGetAccessToken(t *testing.T) {
141141
expected: "mock_access_token",
142142
},
143143
{
144-
description: "should_return_token_when_service_account_key_path_is_set_via_env",
144+
description: "should return token when service account key path is set via env",
145145
setupEnv: func() {
146146
_ = os.Setenv("STACKIT_SERVICE_ACCOUNT_KEY_PATH", "testdata/service_account.json")
147147
},
@@ -158,7 +158,7 @@ func TestGetAccessToken(t *testing.T) {
158158
expected: "mock_access_token",
159159
},
160160
{
161-
description: "should_return_token_when_private_key_is_set_via_env",
161+
description: "should return token when private key is set via env",
162162
setupEnv: func() {
163163
_ = os.Setenv("STACKIT_PRIVATE_KEY", privateKey)
164164
},
@@ -175,7 +175,7 @@ func TestGetAccessToken(t *testing.T) {
175175
expected: "mock_access_token",
176176
},
177177
{
178-
description: "should_return_token_when_private_key_path_is_set_via_env",
178+
description: "should return token when private key path is set via env",
179179
setupEnv: func() {
180180
// Write temp file and set env
181181
tmpFile := writeTempPEMFile(t, privateKey)
@@ -194,7 +194,7 @@ func TestGetAccessToken(t *testing.T) {
194194
expected: "mock_access_token",
195195
},
196196
{
197-
description: "should_fail_when_no_service_account_key_or_private_key_is_set",
197+
description: "should fail when no service account key or private key is set",
198198
cfgFactory: func() *config.Configuration {
199199
return &config.Configuration{
200200
TokenCustomUrl: mockServer.URL,
@@ -204,7 +204,7 @@ func TestGetAccessToken(t *testing.T) {
204204
expected: "",
205205
},
206206
{
207-
description: "should_fail_when_no_service_account_key_or_private_key_is_set_via_env",
207+
description: "should fail when no service account key or private key is set via env",
208208
setupEnv: func() {
209209
_ = os.Unsetenv("STACKIT_SERVICE_ACCOUNT_KEY")
210210
_ = os.Unsetenv("STACKIT_SERVICE_ACCOUNT_KEY_PATH")

0 commit comments

Comments
 (0)