Skip to content

Commit

Permalink
fix: tests for integrations
Browse files Browse the repository at this point in the history
  • Loading branch information
fiftin committed Mar 3, 2024
1 parent 06cf907 commit fc8baea
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 19 deletions.
9 changes: 8 additions & 1 deletion .dredd/hooks/capabilities.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"encoding/json"
"fmt"
"regexp"
"strconv"
"strings"
Expand Down Expand Up @@ -150,6 +151,13 @@ func resolveCapability(caps []string, resolved []string, uid string) {
case "integrationextractor":
integrationextractor = addIntegrationExtractor()
integrationExtractorID = integrationextractor.ID

fmt.Println("******************************")
fmt.Println("******************************")
fmt.Println(integrationExtractorID)
fmt.Println("******************************")
fmt.Println("******************************")

case "integrationextractvalue":
integrationextractvalue = addIntegrationExtractValue()
integrationExtractValueID = integrationextractvalue.ID
Expand Down Expand Up @@ -234,7 +242,6 @@ func alterRequestBody(t *trans.Transaction) {
bodyFieldProcessor("integration_id", integration.ID, &request)
}
if integrationextractor != nil {
//bodyFieldProcessor("integration_id", integrationextractor.IntegrationID, &request)
bodyFieldProcessor("extractor_id", integrationextractor.ID, &request)
}
if integrationextractvalue != nil {
Expand Down
2 changes: 1 addition & 1 deletion .dredd/hooks/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ func addIntegration() *db.Integration {

func addIntegrationExtractor() *db.IntegrationExtractor {
integrationextractor, err := store.CreateIntegrationExtractor(db.IntegrationExtractor{
IntegrationID: int(integrationID),
IntegrationID: integrationID,
Name: "Integration Extractor",
})

Expand Down
2 changes: 1 addition & 1 deletion .dredd/hooks/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func main() {
h.Before("project > /api/project/{project_id}/integrations/{integration_id} > Remove integration > 204 > application/json", capabilityWrapper("integration"))

h.Before("integration > /api/project/{project_id}/integrations/{integration_id}/extractors > Get Integration Extractors > 200 > application/json", capabilityWrapper("integrationextractor"))
h.Before("integration > /api/project/{project_id}/integrations/{integration_id}/extractors > Add Integration Extractor > 204 > application/json", capabilityWrapper("integration"))
h.Before("integration > /api/project/{project_id}/integrations/{integration_id}/extractors > Add Integration Extractor > 201 > application/json", capabilityWrapper("integration"))
h.Before("integration > /api/project/{project_id}/integrations/{integration_id}/extractors/{extractor_id} > Updates Integration extractor > 204 > application/json", capabilityWrapper("integrationextractor"))
h.Before("integration > /api/project/{project_id}/integrations/{integration_id}/extractors/{extractor_id} > Removes integration extractor > 204 > application/json", capabilityWrapper("integrationextractor"))
h.Before("integration > /api/project/{project_id}/integrations/{integration_id}/extractors/{extractor_id}/values > Get Integration Extracted Values linked to integration extractor > 200 > application/json", capabilityWrapper("integrationextractvalue"))
Expand Down
32 changes: 16 additions & 16 deletions api-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1551,26 +1551,26 @@ paths:
schema:
$ref: "#/definitions/IntegrationExtractor"
responses:
204:
201:
description: Integration Extractor Created
/project/{project_id}/integrations/{integration_id}/extractors/{extractor_id}:
parameters:
- $ref: "#/parameters/project_id"
- $ref: "#/parameters/integration_id"
- $ref: "#/parameters/extractor_id"
put:
tags:
- integration
summary: Updates Integration extractor
parameters:
- name: Integration Extractor
in: body
required: true
schema:
$ref: "#/definitions/IntegrationExtractorRequest"
responses:
204:
description: Integration Extractor updated
# put:
# tags:
# - integration
# summary: Updates Integration extractor
# parameters:
# - name: Integration Extractor
# in: body
# required: true
# schema:
# $ref: "#/definitions/IntegrationExtractorRequest"
# responses:
# 204:
# description: Integration Extractor updated
delete:
tags:
- integration
Expand Down Expand Up @@ -1605,7 +1605,7 @@ paths:
schema:
$ref: "#/definitions/IntegrationExtractValue"
responses:
204:
201:
description: Integration Extract Value Created
400:
description: Bad Integration Extract Value params
Expand Down Expand Up @@ -1664,7 +1664,7 @@ paths:
schema:
$ref: "#/definitions/IntegrationMatcher"
responses:
204:
200:
description: Integration Matcher Created
400:
description: Bad Integration Matcher params
Expand Down

0 comments on commit fc8baea

Please sign in to comment.