Skip to content

Commit 016e1aa

Browse files
committed
test(dredd): pass dredd tests
1 parent fe233cb commit 016e1aa

File tree

3 files changed

+42
-44
lines changed

3 files changed

+42
-44
lines changed

.dredd/hooks/main.go

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,10 @@ func main() {
7979
transaction.Request.Body = "{ \"user_id\": " + strconv.Itoa(userPathTestUser.ID) + ",\"role\": \"owner\"}"
8080
})
8181

82-
h.Before("project > /api/project/{project_id}/integrations > get all integrations > 200 > application/json", capabilityWrapper("integration"))
83-
h.Before("project > /api/project/{project_id}/integrations/{integration_id} > Get Integration > 200 > application/json", capabilityWrapper("integration"))
84-
h.Before("project > /api/project/{project_id}/integrations/{integration_id} > Update Integration > 204 > application/json", capabilityWrapper("integration"))
85-
h.Before("project > /api/project/{project_id}/integrations/{integration_id} > Remove integration > 204 > application/json", capabilityWrapper("integration"))
82+
h.Before("integration > /api/project/{project_id}/integrations > get all integrations > 200 > application/json", capabilityWrapper("integration"))
83+
h.Before("integration > /api/project/{project_id}/integrations/{integration_id} > Get Integration > 200 > application/json", capabilityWrapper("integration"))
84+
h.Before("integration > /api/project/{project_id}/integrations/{integration_id} > Update Integration > 204 > application/json", capabilityWrapper("integration"))
85+
h.Before("integration > /api/project/{project_id}/integrations/{integration_id} > Remove integration > 204 > application/json", capabilityWrapper("integration"))
8686

8787
h.Before("integration > /api/project/{project_id}/integrations/{integration_id}/values > Get Integration Extracted Values linked to integration extractor > 200 > application/json", capabilityWrapper("integrationextractvalue"))
8888
h.Before("integration > /api/project/{project_id}/integrations/{integration_id}/values > Add Integration Extracted Value > 204 > application/json", capabilityWrapper("integrationextractvalue"))
@@ -93,41 +93,41 @@ func main() {
9393
h.Before("integration > /api/project/{project_id}/integrations/{integration_id}/matchers > Add Integration Matcher > 204 > application/json", capabilityWrapper("integration"))
9494
h.Before("integration > /api/project/{project_id}/integrations/{integration_id}/matchers/{matcher_id} > Updates Integration Matcher > 204 > application/json", capabilityWrapper("integrationmatcher"))
9595

96-
h.Before("project > /api/project/{project_id}/keys > Add access key > 201 > application/json", capabilityWrapper("access_key"))
97-
h.Before("project > /api/project/{project_id}/keys/{key_id} > Updates access key > 204 > application/json", capabilityWrapper("access_key"))
98-
h.Before("project > /api/project/{project_id}/keys/{key_id} > Removes access key > 204 > application/json", capabilityWrapper("access_key"))
96+
h.Before("key-store > /api/project/{project_id}/keys > Add access key > 201 > application/json", capabilityWrapper("access_key"))
97+
h.Before("key-store > /api/project/{project_id}/keys/{key_id} > Updates access key > 204 > application/json", capabilityWrapper("access_key"))
98+
h.Before("key-store > /api/project/{project_id}/keys/{key_id} > Removes access key > 204 > application/json", capabilityWrapper("access_key"))
9999

100-
h.Before("project > /api/project/{project_id}/repositories > Add repository > 201 > application/json", capabilityWrapper("access_key"))
101-
h.Before("project > /api/project/{project_id}/repositories/{repository_id} > Get repository > 200 > application/json", capabilityWrapper("repository"))
102-
h.Before("project > /api/project/{project_id}/repositories/{repository_id} > Updates repository > 204 > application/json", capabilityWrapper("repository"))
103-
h.Before("project > /api/project/{project_id}/repositories/{repository_id} > Removes repository > 204 > application/json", capabilityWrapper("repository"))
100+
h.Before("repository > /api/project/{project_id}/repositories > Add repository > 201 > application/json", capabilityWrapper("access_key"))
101+
h.Before("repository > /api/project/{project_id}/repositories/{repository_id} > Get repository > 200 > application/json", capabilityWrapper("repository"))
102+
h.Before("repository > /api/project/{project_id}/repositories/{repository_id} > Updates repository > 204 > application/json", capabilityWrapper("repository"))
103+
h.Before("repository > /api/project/{project_id}/repositories/{repository_id} > Removes repository > 204 > application/json", capabilityWrapper("repository"))
104104

105-
h.Before("project > /api/project/{project_id}/inventory > create inventory > 201 > application/json", capabilityWrapper("inventory"))
106-
h.Before("project > /api/project/{project_id}/inventory/{inventory_id} > Get inventory > 200 > application/json", capabilityWrapper("inventory"))
107-
h.Before("project > /api/project/{project_id}/inventory/{inventory_id} > Updates inventory > 204 > application/json", capabilityWrapper("inventory"))
108-
h.Before("project > /api/project/{project_id}/inventory/{inventory_id} > Removes inventory > 204 > application/json", capabilityWrapper("inventory"))
105+
h.Before("inventory > /api/project/{project_id}/inventory > create inventory > 201 > application/json", capabilityWrapper("inventory"))
106+
h.Before("inventory > /api/project/{project_id}/inventory/{inventory_id} > Get inventory > 200 > application/json", capabilityWrapper("inventory"))
107+
h.Before("inventory > /api/project/{project_id}/inventory/{inventory_id} > Updates inventory > 204 > application/json", capabilityWrapper("inventory"))
108+
h.Before("inventory > /api/project/{project_id}/inventory/{inventory_id} > Removes inventory > 204 > application/json", capabilityWrapper("inventory"))
109109

110-
h.Before("project > /api/project/{project_id}/environment > Add environment > 201 > application/json", capabilityWrapper("environment"))
111-
h.Before("project > /api/project/{project_id}/environment/{environment_id} > Get environment > 200 > application/json", capabilityWrapper("environment"))
112-
h.Before("project > /api/project/{project_id}/environment/{environment_id} > Update environment > 204 > application/json", capabilityWrapper("environment"))
113-
h.Before("project > /api/project/{project_id}/environment/{environment_id} > Removes environment > 204 > application/json", capabilityWrapper("environment"))
110+
h.Before("variable-group > /api/project/{project_id}/environment > Add environment > 201 > application/json", capabilityWrapper("environment"))
111+
h.Before("variable-group > /api/project/{project_id}/environment/{environment_id} > Get environment > 200 > application/json", capabilityWrapper("environment"))
112+
h.Before("variable-group > /api/project/{project_id}/environment/{environment_id} > Update environment > 204 > application/json", capabilityWrapper("environment"))
113+
h.Before("variable-group > /api/project/{project_id}/environment/{environment_id} > Removes environment > 204 > application/json", capabilityWrapper("environment"))
114114

115-
h.Before("project > /api/project/{project_id}/templates > create template > 201 > application/json", func(t *trans.Transaction) {
115+
h.Before("template > /api/project/{project_id}/templates > create template > 201 > application/json", func(t *trans.Transaction) {
116116
addCapabilities([]string{"repository", "inventory", "environment", "view"})
117117
})
118118

119-
h.Before("project > /api/project/{project_id}/templates/{template_id} > Get template > 200 > application/json", capabilityWrapper("template"))
120-
h.Before("project > /api/project/{project_id}/templates/{template_id} > Updates template > 204 > application/json", capabilityWrapper("template"))
121-
h.Before("project > /api/project/{project_id}/templates/{template_id} > Removes template > 204 > application/json", capabilityWrapper("template"))
119+
h.Before("template > /api/project/{project_id}/templates/{template_id} > Get template > 200 > application/json", capabilityWrapper("template"))
120+
h.Before("template > /api/project/{project_id}/templates/{template_id} > Updates template > 204 > application/json", capabilityWrapper("template"))
121+
h.Before("template > /api/project/{project_id}/templates/{template_id} > Removes template > 204 > application/json", capabilityWrapper("template"))
122122

123-
h.Before("project > /api/project/{project_id}/tasks > Starts a job > 201 > application/json", capabilityWrapper("template"))
124-
h.Before("project > /api/project/{project_id}/tasks/last > Get last 200 Tasks related to current project > 200 > application/json", capabilityWrapper("template"))
123+
h.Before("task > /api/project/{project_id}/tasks > Starts a job > 201 > application/json", capabilityWrapper("template"))
124+
h.Before("task > /api/project/{project_id}/tasks/last > Get last 200 Tasks related to current project > 200 > application/json", capabilityWrapper("template"))
125125

126-
h.Before("project > /api/project/{project_id}/tasks/{task_id} > Get a single task > 200 > application/json", capabilityWrapper("task"))
127-
h.Before("project > /api/project/{project_id}/tasks/{task_id} > Deletes task (including output) > 204 > application/json", capabilityWrapper("task"))
128-
h.Before("project > /api/project/{project_id}/tasks/{task_id}/output > Get task output > 200 > application/json", capabilityWrapper("task"))
129-
h.Before("project > /api/project/{project_id}/tasks/{task_id}/raw_output > Get task raw output > 200 > text/plain; charset=utf-8", capabilityWrapper("task"))
130-
h.Before("project > /api/project/{project_id}/tasks/{task_id}/stop > Stop a job > 204 > application/json", capabilityWrapper("task"))
126+
h.Before("task > /api/project/{project_id}/tasks/{task_id} > Get a single task > 200 > application/json", capabilityWrapper("task"))
127+
h.Before("task > /api/project/{project_id}/tasks/{task_id} > Deletes task (including output) > 204 > application/json", capabilityWrapper("task"))
128+
h.Before("task > /api/project/{project_id}/tasks/{task_id}/output > Get task output > 200 > application/json", capabilityWrapper("task"))
129+
h.Before("task > /api/project/{project_id}/tasks/{task_id}/raw_output > Get task raw output > 200 > text/plain; charset=utf-8", capabilityWrapper("task"))
130+
h.Before("task > /api/project/{project_id}/tasks/{task_id}/stop > Stop a job > 204 > application/json", capabilityWrapper("task"))
131131

132132
h.Before("schedule > /api/project/{project_id}/schedules/{schedule_id} > Get schedule > 200 > application/json", capabilityWrapper("schedule"))
133133
h.Before("schedule > /api/project/{project_id}/schedules/{schedule_id} > Updates schedule > 204 > application/json", capabilityWrapper("schedule"))

api-docs.yml

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,9 +1036,7 @@ definitions:
10361036
use_remote_runner:
10371037
type: boolean
10381038
auth_methods:
1039-
type: array
1040-
items:
1041-
type: string
1039+
type: object
10421040
git_client:
10431041
type: string
10441042
schedule_timezone:
@@ -1830,7 +1828,7 @@ paths:
18301828
- $ref: "#/parameters/project_id"
18311829
get:
18321830
tags:
1833-
- key store
1831+
- key-store
18341832
summary: Get access keys linked to project
18351833
parameters:
18361834
# TODO - the space in this parameter name results in a dredd warning
@@ -1864,7 +1862,7 @@ paths:
18641862
$ref: "#/definitions/AccessKey"
18651863
post:
18661864
tags:
1867-
- key store
1865+
- key-store
18681866
summary: Add access key
18691867
parameters:
18701868
- name: Access Key
@@ -1885,7 +1883,7 @@ paths:
18851883
- $ref: "#/parameters/key_id"
18861884
put:
18871885
tags:
1888-
- key store
1886+
- key-store
18891887
summary: Updates access key
18901888
parameters:
18911889
- name: Access Key
@@ -1900,7 +1898,7 @@ paths:
19001898
description: Bad type
19011899
delete:
19021900
tags:
1903-
- key store
1901+
- key-store
19041902
summary: Removes access key
19051903
responses:
19061904
204:
@@ -2070,7 +2068,7 @@ paths:
20702068
- $ref: "#/parameters/project_id"
20712069
get:
20722070
tags:
2073-
- variable group (environment)
2071+
- variable-group
20742072
summary: Get environment
20752073
parameters:
20762074
- name: sort
@@ -2096,7 +2094,7 @@ paths:
20962094
$ref: "#/definitions/Environment"
20972095
post:
20982096
tags:
2099-
- variable group (environment)
2097+
- variable-group
21002098
summary: Add environment
21012099
parameters:
21022100
- name: environment
@@ -2115,7 +2113,7 @@ paths:
21152113
- $ref: "#/parameters/environment_id"
21162114
get:
21172115
tags:
2118-
- variable group (environment)
2116+
- variable-group
21192117
summary: Get environment
21202118
responses:
21212119
200:
@@ -2124,7 +2122,7 @@ paths:
21242122
$ref: "#/definitions/Environment"
21252123
put:
21262124
tags:
2127-
- variable group (environment)
2125+
- variable-group
21282126
summary: Update environment
21292127
parameters:
21302128
- name: environment
@@ -2137,7 +2135,7 @@ paths:
21372135
description: Environment Updated
21382136
delete:
21392137
tags:
2140-
- variable group (environment)
2138+
- variable-group
21412139
summary: Removes environment
21422140
responses:
21432141
204:
@@ -2436,7 +2434,7 @@ paths:
24362434
- $ref: "#/parameters/task_id"
24372435
get:
24382436
tags:
2439-
- project
2437+
- task
24402438
summary: Get a single task
24412439
responses:
24422440
200:

db/Environment.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ type Environment struct {
4949
ENV *string `db:"env" json:"env" binding:"required"`
5050

5151
// Secrets is a field which used to update secrets associated with the environment.
52-
Secrets []EnvironmentSecret `db:"-" json:"secrets" backup:"-"`
52+
Secrets []EnvironmentSecret `db:"-" json:"secrets,omitempty" backup:"-"`
5353

5454
SecretStorageID *int `db:"secret_storage_id" json:"secret_storage_id,omitempty" backup:"-"`
5555
SecretStorageKeyPrefix *string `db:"secret_storage_key_prefix" json:"secret_storage_key_prefix,omitempty"`

0 commit comments

Comments
 (0)