Skip to content

Commit

Permalink
Merge pull request #185 from technosophos/fix/claims-pending
Browse files Browse the repository at this point in the history
Change underway to pending
  • Loading branch information
silvin-lubecki authored Feb 26, 2020
2 parents 0e72b0a + 02f6fba commit 1afc612
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
8 changes: 4 additions & 4 deletions claim/claim.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ const DefaultSchemaVersion = schemaversion.SchemaVersion("v1.0.0-WD")

// Status constants define the CNAB status fields on a Result.
const (
StatusSuccess = "success"
StatusFailure = "failure"
StatusUnderway = "underway"
StatusUnknown = "unknown"
StatusSuccess = "success"
StatusFailure = "failure"
StatusPending = "pending"
StatusUnknown = "unknown"
)

// Action constants define the CNAB action to be taken
Expand Down
7 changes: 4 additions & 3 deletions claim/claim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"encoding/json"
"io/ioutil"
"net/http"
"strings"
"testing"
"time"

Expand Down Expand Up @@ -95,7 +96,7 @@ func TestMarshal_New(t *testing.T) {
wantClaim, err := ioutil.ReadFile("testdata/claim.default.json")
assert.NoError(t, err, "failed to read test claim")

assert.Equal(t, string(wantClaim), string(bytes), "marshaled claim does not match expected")
assert.Equal(t, string(wantClaim), strings.TrimSpace(string(bytes)), "marshaled claim does not match expected")
}

var exampleClaim = Claim{
Expand All @@ -108,7 +109,7 @@ var exampleClaim = Claim{
Result: Result{
Action: ActionInstall,
Message: "result message",
Status: StatusUnderway,
Status: StatusPending,
},
Parameters: map[string]interface{}{
"myparam": "myparamvalue",
Expand Down Expand Up @@ -141,7 +142,7 @@ func TestMarshal_AllFields(t *testing.T) {
wantClaim, err := ioutil.ReadFile("testdata/claim.allfields.json")
assert.NoError(t, err, "failed to read test claim")

assert.Equal(t, string(wantClaim), string(bytes), "marshaled claim does not match expected")
assert.Equal(t, strings.TrimSpace(string(wantClaim)), string(bytes), "marshaled claim does not match expected")
}

func TestClaimSchema(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion claim/testdata/claim.allfields.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"schemaVersion":"v1.0.0-WD","installation":"my_claim","revision":"revision","created":"1983-04-18T01:02:03.000000004Z","modified":"1983-04-18T01:02:03.000000004Z","bundle":{"schemaVersion":"schemaVersion","name":"mybun","version":"v0.1.0","description":"this is my bundle","invocationImages":[]},"result":{"message":"result message","action":"install","status":"underway"},"parameters":{"myparam":"myparamvalue"},"outputs":{"myoutput":"myoutputvalue"},"custom":["anything goes"]}
{"schemaVersion":"v1.0.0-WD","installation":"my_claim","revision":"revision","created":"1983-04-18T01:02:03.000000004Z","modified":"1983-04-18T01:02:03.000000004Z","bundle":{"schemaVersion":"schemaVersion","name":"mybun","version":"v0.1.0","description":"this is my bundle","invocationImages":[]},"result":{"message":"result message","action":"install","status":"pending"},"parameters":{"myparam":"myparamvalue"},"outputs":{"myoutput":"myoutputvalue"},"custom":["anything goes"]}

0 comments on commit 1afc612

Please sign in to comment.