diff --git a/Gopkg.lock b/Gopkg.lock index e7f0c698e9..3e5370bdd3 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -587,6 +587,12 @@ packages = ["."] revision = "3f523f4c14b6e925da10475eb0447c2f28614aac" +[[projects]] + branch = "master" + name = "github.com/yalp/jsonpath" + packages = ["."] + revision = "5cc68e5049a040829faef3a44c00ec4332f6dec7" + [[projects]] branch = "master" name = "github.com/zach-klippenstein/goregen" @@ -815,6 +821,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "2cc7ef0be20098d353879618874ca294af4e31fb40a9612f0949ec06419da65f" + inputs-digest = "3847984e317f7f997a55112557354ae0968625fe4fd62dc16d3df50d5681a4c9" solver-name = "gps-cdcl" solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml index d2f8a1b09a..9929f125ac 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -154,3 +154,8 @@ ignored = [ go-tests = true unused-packages = true +[[constraint]] + branch = "master" + name = "github.com/yalp/jsonpath" + + diff --git a/controller/golden_files_test.go b/controller/golden_files_test.go index 8765d266e6..75ad4b0eec 100644 --- a/controller/golden_files_test.go +++ b/controller/golden_files_test.go @@ -19,6 +19,7 @@ import ( uuid "github.com/satori/go.uuid" "github.com/sergi/go-diff/diffmatchpatch" "github.com/stretchr/testify/require" + "github.com/yalp/jsonpath" ) var updateGoldenFiles = flag.Bool("update", false, "when set, rewrite the golden files") @@ -29,8 +30,13 @@ var updateGoldenFiles = flag.Bool("update", false, "when set, rewrite the golden // -update flag is given, that golden file is overwritten with the current // actual object. When adding new tests you first must run them with the -update // flag in order to create an initial golden version. -func compareWithGolden(t *testing.T, goldenFile string, actualObj interface{}) { - err := testableCompareWithGolden(*updateGoldenFiles, goldenFile, actualObj, false, false) +// +// The stripDownToPattern is an optional argument that can take a JSON path (see +// http://goessner.net/articles/JsonPath/) string to remove anything from the +// actual and expected test output before comparison and saving it to a golden +// file (if -update is given). +func compareWithGolden(t *testing.T, goldenFile string, actualObj interface{}, stripDownToPattern ...string) { + err := _testableCompareWithGolden(*updateGoldenFiles, goldenFile, actualObj, false, false, stripDownToPattern...) if err != nil { t.Fatalf("%+v", err) } @@ -47,8 +53,8 @@ func compareWithGolden(t *testing.T, goldenFile string, actualObj interface{}) { // // In addition to UUID replacement, we also replace all RFC3339 time strings // with "0001-01-01T00:00:00Z". -func compareWithGoldenAgnostic(t *testing.T, goldenFile string, actualObj interface{}) { - err := testableCompareWithGolden(*updateGoldenFiles, goldenFile, actualObj, true, true) +func compareWithGoldenAgnostic(t *testing.T, goldenFile string, actualObj interface{}, stripDownToPattern ...string) { + err := _testableCompareWithGolden(*updateGoldenFiles, goldenFile, actualObj, true, true, stripDownToPattern...) if err != nil { t.Fatalf("%+v", err) } @@ -56,8 +62,8 @@ func compareWithGoldenAgnostic(t *testing.T, goldenFile string, actualObj interf // compareWithGoldenAgnosticUUID is only agnostic to UUIDs apart from that it is // the same as compareWithGoldenAgnostic. -func compareWithGoldenAgnosticUUID(t *testing.T, goldenFile string, actualObj interface{}) { - err := testableCompareWithGolden(*updateGoldenFiles, goldenFile, actualObj, true, false) +func compareWithGoldenAgnosticUUID(t *testing.T, goldenFile string, actualObj interface{}, stripDownToPattern ...string) { + err := _testableCompareWithGolden(*updateGoldenFiles, goldenFile, actualObj, true, false, stripDownToPattern...) if err != nil { t.Fatalf("%+v", err) } @@ -65,14 +71,14 @@ func compareWithGoldenAgnosticUUID(t *testing.T, goldenFile string, actualObj in // compareWithGoldenAgnosticTime is only agnostic to times apart from that it is // the same as compareWithGoldenAgnostic. -func compareWithGoldenAgnosticTime(t *testing.T, goldenFile string, actualObj interface{}) { - err := testableCompareWithGolden(*updateGoldenFiles, goldenFile, actualObj, false, true) +func compareWithGoldenAgnosticTime(t *testing.T, goldenFile string, actualObj interface{}, stripDownToPattern ...string) { + err := _testableCompareWithGolden(*updateGoldenFiles, goldenFile, actualObj, false, true, stripDownToPattern...) if err != nil { t.Fatalf("%+v", err) } } -func testableCompareWithGolden(update bool, goldenFile string, actualObj interface{}, uuidAgnostic bool, timeAgnostic bool) error { +func _testableCompareWithGolden(update bool, goldenFile string, actualObj interface{}, uuidAgnostic bool, timeAgnostic bool, stripDownToPattern ...string) error { absPath, err := filepath.Abs(goldenFile) if err != nil { return errs.WithStack(err) @@ -81,6 +87,9 @@ func testableCompareWithGolden(update bool, goldenFile string, actualObj interfa if err != nil { return errs.WithStack(err) } + if len(stripDownToPattern) > 1 { + return errs.Errorf("the number of strip down parameters must not be greater than 1 but is: %d", len(stripDownToPattern)) + } if update { // Make sure the directory exists where to write the file to err := os.MkdirAll(filepath.Dir(absPath), os.FileMode(0777)) @@ -92,17 +101,24 @@ func testableCompareWithGolden(update bool, goldenFile string, actualObj interfa // Eliminate concrete UUIDs if requested. This makes adding changes to // golden files much more easy in git. if uuidAgnostic { - tmp, err = replaceUUIDs(tmp) + tmp, err = _replaceUUIDs(tmp) if err != nil { return errs.Wrap(err, "failed to replace UUIDs with more generic ones") } } if timeAgnostic { - tmp, err = replaceTimes(tmp) + tmp, err = _replaceTimes(tmp) if err != nil { return errs.Wrap(err, "failed to replace RFC3339 times with default time") } } + if len(stripDownToPattern) > 0 { + pattern := stripDownToPattern[0] + tmp, err = _stripDownTo(tmp, pattern) + if err != nil { + return errs.Wrapf(err, "failed strip down expected string to pattern: %s", pattern) + } + } err = ioutil.WriteFile(absPath, []byte(tmp), os.ModePerm) if err != nil { return errs.Wrapf(err, "failed to update golden file: %s", absPath) @@ -116,40 +132,39 @@ func testableCompareWithGolden(update bool, goldenFile string, actualObj interfa expectedStr := string(expected) actualStr := string(actual) if uuidAgnostic { - expectedStr, err = replaceUUIDs(expectedStr) - if err != nil { - return errs.Wrapf(err, "failed to replace UUIDs with more generic ones") - } - actualStr, err = replaceUUIDs(actualStr) + actualStr, err = _replaceUUIDs(actualStr) if err != nil { return errs.Wrapf(err, "failed to replace UUIDs with more generic ones") } } if timeAgnostic { - expectedStr, err = replaceTimes(expectedStr) + actualStr, err = _replaceTimes(actualStr) if err != nil { return errs.Wrap(err, "failed to replace RFC3339 times with default time") } - actualStr, err = replaceTimes(actualStr) + } + if len(stripDownToPattern) > 0 { + pattern := stripDownToPattern[0] + actualStr, err = _stripDownTo(actualStr, pattern) if err != nil { - return errs.Wrap(err, "failed to replace RFC3339 times with default time") + return errs.Wrapf(err, "failed strip down actual string to pattern: %s", pattern) } } if expectedStr != actualStr { - log.Error(nil, nil, "testableCompareWithGolden: expected value %v", expectedStr) - log.Error(nil, nil, "testableCompareWithGolden: actual value %v", actualStr) + log.Error(nil, nil, "_testableCompareWithGolden: expected value %v", expectedStr) + log.Error(nil, nil, "_testableCompareWithGolden: actual value %v", actualStr) dmp := diffmatchpatch.New() diffs := dmp.DiffMain(expectedStr, actualStr, false) - log.Error(nil, nil, "testableCompareWithGolden: mismatch of actual output and golden-file %s:\n %s \n", absPath, dmp.DiffPrettyText(diffs)) + log.Error(nil, nil, "_testableCompareWithGolden: mismatch of actual output and golden-file %s:\n %s \n", absPath, dmp.DiffPrettyText(diffs)) return errs.Errorf("mismatch of actual output and golden-file %s:\n %s \n", absPath, dmp.DiffPrettyText(diffs)) } return nil } -// findUUIDs returns an array of uniq UUIDs that have been found in the given +// _findUUIDs returns an array of unique UUIDs that have been found in the given // string -func findUUIDs(str string) ([]uuid.UUID, error) { +func _findUUIDs(str string) ([]uuid.UUID, error) { pattern := "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}" uuidRegexp, err := regexp.Compile(pattern) if err != nil { @@ -172,13 +187,13 @@ func findUUIDs(str string) ([]uuid.UUID, error) { return res, nil } -// replaceUUIDs finds all UUIDs in the given string and replaces them with +// _replaceUUIDs finds all UUIDs in the given string and replaces them with // "00000000-0000-0000-0000-000000000001, // "00000000-0000-0000-0000-000000000002", ..., // "00000000-0000-0000-0000-00000000000N" -func replaceUUIDs(str string) (string, error) { +func _replaceUUIDs(str string) (string, error) { replacementPattern := "00000000-0000-0000-0000-%012d" - ids, err := findUUIDs(str) + ids, err := _findUUIDs(str) if err != nil { return "", errs.Wrapf(err, "failed to find UUIDs in string %s", str) } @@ -189,10 +204,10 @@ func replaceUUIDs(str string) (string, error) { return newStr, nil } -// replaceTimes finds all RFC3339 times and RFC7232 (section 2.2) times in the +// _replaceTimes finds all RFC3339 times and RFC7232 (section 2.2) times in the // given string and replaces them with "0001-01-01T00:00:00Z" (for RFC3339) or // "Mon, 01 Jan 0001 00:00:00 GMT" (for RFC7232) respectively. -func replaceTimes(str string) (string, error) { +func _replaceTimes(str string) (string, error) { year := "([0-9]+)" month := "(0[1-9]|1[012])" day := "(0[1-9]|[12][0-9]|3[01])" @@ -232,7 +247,58 @@ func replaceTimes(str string) (string, error) { return lastModifiedPattern.ReplaceAllString(res, `Mon, 01 Jan 0001 00:00:00 GMT`), nil } -const testInputStr = ` +// _stripDownTo strips down the given JSON string using the given JSON Path. See +// also: http://goessner.net/articles/JsonPath/ for more information on JSON +// Path and https://godoc.org/github.com/yalp/jsonpath#example-Read for the +// implementation and its limitations, e.g. strings in square brackets must use +// double quotes. +func _stripDownTo(obj, jsonPath string) (string, error) { + var jsonObj interface{} + if err := json.Unmarshal([]byte(obj), &jsonObj); err != nil { + return "", errs.Wrapf(err, "failed to unmarshall string as JSON: %s", obj) + } + + strippedDown, err := jsonpath.Read(jsonObj, jsonPath) + if err != nil { + return "", errs.Wrapf(err, "failed to lookup path `%s` in JSON: %s", jsonPath, obj) + } + + e, err := json.Marshal(strippedDown) + if err != nil { + return "", errs.Wrapf(err, "failed marshal stripped down JSON to string: %s", strippedDown) + } + return string(e), nil +} + +func TestStripDownTo(t *testing.T) { + type testData struct { + testName string + input string + pattern string + output string + wantErr bool + } + td := []testData{ + {"Simple query with dot", `{"foo": "bar"}`, `$.foo`, `"bar"`, false}, + {"Simple query with slash", `{"foo": "bar"}`, `$["foo"]`, `"bar"`, false}, + {"with dot in name", `{"system.title": "foobar"}`, `$["system.title"]`, `"foobar"`, false}, + {"mixed addressing", `{"data":{"attributes":{"system.title": "foobar"}}}`, `$.data.attributes["system.title"]`, `"foobar"`, false}, + {"error in input (missing closing bracket)", `{"foo":"bar"`, `$.foo.bar`, "", true}, + } + for _, d := range td { + t.Run(d.testName, func(t *testing.T) { + output, err := _stripDownTo(d.input, d.pattern) + if d.wantErr { + require.Error(t, err) + return + } + require.NoError(t, err) + require.Equal(t, d.output, output) + }) + } +} + +const _testInputStr = ` { "data": { "attributes": { @@ -263,7 +329,7 @@ const testInputStr = ` } }` -const testUUIDOutputStr = ` +const _testUUIDOutputStr = ` { "data": { "attributes": { @@ -294,11 +360,11 @@ const testUUIDOutputStr = ` } }` -func TestGoldenFindUUIDs(t *testing.T) { +func TestGolden_findUUIDs(t *testing.T) { t.Parallel() t.Run("find UUIDs", func(t *testing.T) { t.Parallel() - ids, err := findUUIDs(testInputStr) + ids, err := _findUUIDs(_testInputStr) require.NoError(t, err) require.Equal(t, []uuid.UUID{ uuid.FromStringOrNil("d7a282f6-1c10-459e-bb44-55a1a6d48bdd"), @@ -307,17 +373,17 @@ func TestGoldenFindUUIDs(t *testing.T) { }) } -func TestGoldenReplaceUUIDs(t *testing.T) { +func TestGolden_replaceUUIDs(t *testing.T) { t.Parallel() t.Run("replace UUIDs", func(t *testing.T) { t.Parallel() - newStr, err := replaceUUIDs(testInputStr) + newStr, err := _replaceUUIDs(_testInputStr) require.NoError(t, err) - require.Equal(t, testUUIDOutputStr, newStr) + require.Equal(t, _testUUIDOutputStr, newStr) }) } -const testTimesOutputStr = ` +const _testTimesOutputStr = ` { "data": { "attributes": { @@ -348,13 +414,13 @@ const testTimesOutputStr = ` } }` -func TestGoldenReplaceTimes(t *testing.T) { +func TestGolden_replaceTimes(t *testing.T) { t.Parallel() t.Run("rfc3339", func(t *testing.T) { t.Parallel() - newStr, err := replaceTimes(testInputStr) + newStr, err := _replaceTimes(_testInputStr) require.NoError(t, err) - require.Equal(t, testTimesOutputStr, newStr) + require.Equal(t, _testTimesOutputStr, newStr) }) timeStrings := map[string]string{ "rfc7232": `"last-modified": "Thu, 15 Mar 2018 09:23:37 GMT",`, @@ -366,7 +432,7 @@ func TestGoldenReplaceTimes(t *testing.T) { t.Run(timeType, func(t *testing.T) { t.Parallel() expected := `"last-modified": "Mon, 01 Jan 0001 00:00:00 GMT",` - actual, err := replaceTimes(timeString) + actual, err := _replaceTimes(timeString) // then require.NoError(t, err) require.Equal(t, expected, actual) @@ -390,7 +456,7 @@ func TestGoldenCompareWithGolden(t *testing.T) { // given f := "not_existing_file.golden.json" // when - err := testableCompareWithGolden(false, f, dummy, agnostic, agnostic) + err := _testableCompareWithGolden(false, f, dummy, agnostic, agnostic) // then require.Error(t, err) _, isPathError := errs.Cause(err).(*os.PathError) @@ -400,7 +466,7 @@ func TestGoldenCompareWithGolden(t *testing.T) { // given f := "not/existing/folder/file.golden.json" // when - err := testableCompareWithGolden(true, f, dummy, agnostic, agnostic) + err := _testableCompareWithGolden(true, f, dummy, agnostic, agnostic) // then // then double check that file exists and no error occurred require.NoError(t, err) @@ -412,7 +478,7 @@ func TestGoldenCompareWithGolden(t *testing.T) { // given f := "test-files/codebase/show/ok_without_auth.golden.json" // when - err := testableCompareWithGolden(false, f, dummy, agnostic, agnostic) + err := _testableCompareWithGolden(false, f, dummy, agnostic, agnostic) // then require.Error(t, err) _, isPathError := errs.Cause(err).(*os.PathError) @@ -423,26 +489,57 @@ func TestGoldenCompareWithGolden(t *testing.T) { t.Run("comparing with existing file", func(t *testing.T) { // given - f := "test-files/dummy.golden.json" bs, err := json.MarshalIndent(dummy, "", " ") require.NoError(t, err) - err = ioutil.WriteFile(f, bs, os.ModePerm) - require.NoError(t, err) - defer func() { - err := os.Remove(f) + + removeFile := func(t *testing.T, filepath string) { + err := os.Remove(filepath) require.NoError(t, err) - }() + } + + filePure := "test-files/dummy.golden.json" + err = ioutil.WriteFile(filePure, bs, os.ModePerm) + require.NoError(t, err) + defer removeFile(t, filePure) + + fileAgnosticTime := "test-files/dummy-agnostic-time.golden.json" + replacedTimes, err := _replaceTimes(string(bs)) + require.NoError(t, err) + err = ioutil.WriteFile(fileAgnosticTime, []byte(replacedTimes), os.ModePerm) + require.NoError(t, err) + defer removeFile(t, fileAgnosticTime) + + fileAgnosticUUID := "test-files/dummy-agnostic-uuid.golden.json" + replacedUUIDs, err := _replaceUUIDs(string(bs)) + require.NoError(t, err) + err = ioutil.WriteFile(fileAgnosticUUID, []byte(replacedUUIDs), os.ModePerm) + require.NoError(t, err) + defer removeFile(t, fileAgnosticUUID) + + fileAgnostic := "test-files/dummy-agnostic.golden.json" + replacedUUIDsAndTimes, err := _replaceUUIDs(replacedTimes) + require.NoError(t, err) + err = ioutil.WriteFile(fileAgnostic, []byte(replacedUUIDsAndTimes), os.ModePerm) + require.NoError(t, err) + defer removeFile(t, fileAgnostic) + + fileBar := "test-files/dummy-bar.golden.json" + justBar, err := _stripDownTo(string(bs), "$.Bar") + require.NoError(t, err) + err = ioutil.WriteFile(fileBar, []byte(justBar), os.ModePerm) + require.NoError(t, err) + defer removeFile(t, fileBar) t.Run("comparing with the same object", func(t *testing.T) { t.Run("not agnostic", func(t *testing.T) { // when - err = testableCompareWithGolden(false, f, dummy, false, false) + err = _testableCompareWithGolden(false, filePure, dummy, false, false) // then require.NoError(t, err) }) t.Run("agnostic", func(t *testing.T) { // when - err = testableCompareWithGolden(false, f, dummy, true, true) + err = _testableCompareWithGolden(false, fileAgnostic, dummy, true, true) // then require.NoError(t, err) }) @@ -451,13 +548,13 @@ func TestGoldenCompareWithGolden(t *testing.T) { dummy.ID = uuid.NewV4() t.Run("not agnostic", func(t *testing.T) { // when - err = testableCompareWithGolden(false, f, dummy, false, false) + err = _testableCompareWithGolden(false, filePure, dummy, false, false) // then require.Error(t, err) }) t.Run("agnostic", func(t *testing.T) { // when - err = testableCompareWithGolden(false, f, dummy, true, true) + err = _testableCompareWithGolden(false, fileAgnostic, dummy, true, true) // then require.NoError(t, err) }) @@ -466,17 +563,37 @@ func TestGoldenCompareWithGolden(t *testing.T) { dummy.CreatedAt = time.Now() t.Run("not agnostic", func(t *testing.T) { // when - err = testableCompareWithGolden(false, f, dummy, false, false) + err = _testableCompareWithGolden(false, filePure, dummy, false, false) // then require.Error(t, err) }) t.Run("agnostic", func(t *testing.T) { // when - err = testableCompareWithGolden(false, f, dummy, true, true) + err = _testableCompareWithGolden(false, fileAgnostic, dummy, true, true) // then require.NoError(t, err) }) }) + t.Run("strip down", func(t *testing.T) { + t.Run("ok", func(t *testing.T) { + // when + err = _testableCompareWithGolden(false, fileBar, dummy, false, false, "$.Bar") + // then + require.NoError(t, err) + }) + t.Run("error: more than one pattern given", func(t *testing.T) { + // when + err = _testableCompareWithGolden(false, fileBar, dummy, false, false, "$.Bar", "$.Bar") + // then + require.Error(t, err) + }) + t.Run("error: not existing path", func(t *testing.T) { + // when + err = _testableCompareWithGolden(false, fileBar, dummy, false, false, "$.not.existing.path") + // then + require.Error(t, err) + }) + }) }) } diff --git a/controller/test-files/work_item/update/area/valid_sample_1.res.payload.golden.json b/controller/test-files/work_item/update/area/valid_sample_1.res.payload.golden.json index 3af17f4afc..1d027b2c4c 100755 --- a/controller/test-files/work_item/update/area/valid_sample_1.res.payload.golden.json +++ b/controller/test-files/work_item/update/area/valid_sample_1.res.payload.golden.json @@ -1,89 +1 @@ -{ - "data": { - "attributes": { - "area_field": "00000000-0000-0000-0000-000000000001", - "system.created_at": "0001-01-01T00:00:00Z", - "system.metastate": null, - "system.number": 1, - "system.order": 1000, - "system.remote_item_id": null, - "system.state": "new", - "system.title": "area_wi", - "system.updated_at": "0001-01-01T00:00:00Z", - "version": 1 - }, - "id": "00000000-0000-0000-0000-000000000002", - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000002", - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000002" - }, - "relationships": { - "area": {}, - "assignees": {}, - "baseType": { - "data": { - "id": "00000000-0000-0000-0000-000000000003", - "type": "workitemtypes" - }, - "links": { - "self": "http:///api/workitemtypes/00000000-0000-0000-0000-000000000003" - } - }, - "children": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000002/children" - }, - "meta": { - "hasChildren": false - } - }, - "comments": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000002/comments", - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000002/relationships/comments" - } - }, - "creator": { - "data": { - "id": "00000000-0000-0000-0000-000000000004", - "type": "users" - }, - "links": { - "related": "http:///api/users/00000000-0000-0000-0000-000000000004", - "self": "http:///api/users/00000000-0000-0000-0000-000000000004" - } - }, - "events": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000002/events" - } - }, - "iteration": {}, - "labels": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000002/labels" - } - }, - "space": { - "data": { - "id": "00000000-0000-0000-0000-000000000005", - "type": "spaces" - }, - "links": { - "related": "http:///api/spaces/00000000-0000-0000-0000-000000000005", - "self": "http:///api/spaces/00000000-0000-0000-0000-000000000005" - } - }, - "system.boardcolumns": {}, - "workItemLinks": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000002/links" - } - } - }, - "type": "workitems" - }, - "links": { - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000002" - } -} \ No newline at end of file +"00000000-0000-0000-0000-000000000001" \ No newline at end of file diff --git a/controller/test-files/work_item/update/boardcolumn/valid_sample_1.res.payload.golden.json b/controller/test-files/work_item/update/boardcolumn/valid_sample_1.res.payload.golden.json index 6e7259eebe..1d027b2c4c 100755 --- a/controller/test-files/work_item/update/boardcolumn/valid_sample_1.res.payload.golden.json +++ b/controller/test-files/work_item/update/boardcolumn/valid_sample_1.res.payload.golden.json @@ -1,89 +1 @@ -{ - "data": { - "attributes": { - "boardcolumn_field": "00000000-0000-0000-0000-000000000001", - "system.created_at": "0001-01-01T00:00:00Z", - "system.metastate": null, - "system.number": 2, - "system.order": 2000, - "system.remote_item_id": null, - "system.state": "new", - "system.title": "boardcolumn_wi", - "system.updated_at": "0001-01-01T00:00:00Z", - "version": 1 - }, - "id": "00000000-0000-0000-0000-000000000002", - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000002", - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000002" - }, - "relationships": { - "area": {}, - "assignees": {}, - "baseType": { - "data": { - "id": "00000000-0000-0000-0000-000000000003", - "type": "workitemtypes" - }, - "links": { - "self": "http:///api/workitemtypes/00000000-0000-0000-0000-000000000003" - } - }, - "children": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000002/children" - }, - "meta": { - "hasChildren": false - } - }, - "comments": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000002/comments", - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000002/relationships/comments" - } - }, - "creator": { - "data": { - "id": "00000000-0000-0000-0000-000000000004", - "type": "users" - }, - "links": { - "related": "http:///api/users/00000000-0000-0000-0000-000000000004", - "self": "http:///api/users/00000000-0000-0000-0000-000000000004" - } - }, - "events": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000002/events" - } - }, - "iteration": {}, - "labels": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000002/labels" - } - }, - "space": { - "data": { - "id": "00000000-0000-0000-0000-000000000005", - "type": "spaces" - }, - "links": { - "related": "http:///api/spaces/00000000-0000-0000-0000-000000000005", - "self": "http:///api/spaces/00000000-0000-0000-0000-000000000005" - } - }, - "system.boardcolumns": {}, - "workItemLinks": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000002/links" - } - } - }, - "type": "workitems" - }, - "links": { - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000002" - } -} \ No newline at end of file +"00000000-0000-0000-0000-000000000001" \ No newline at end of file diff --git a/controller/test-files/work_item/update/bool/valid_sample_1.res.payload.golden.json b/controller/test-files/work_item/update/bool/valid_sample_1.res.payload.golden.json index 3ae0717d1b..02e4a84d62 100755 --- a/controller/test-files/work_item/update/bool/valid_sample_1.res.payload.golden.json +++ b/controller/test-files/work_item/update/bool/valid_sample_1.res.payload.golden.json @@ -1,89 +1 @@ -{ - "data": { - "attributes": { - "bool_field": false, - "system.created_at": "0001-01-01T00:00:00Z", - "system.metastate": null, - "system.number": 3, - "system.order": 3000, - "system.remote_item_id": null, - "system.state": "new", - "system.title": "bool_wi", - "system.updated_at": "0001-01-01T00:00:00Z", - "version": 1 - }, - "id": "00000000-0000-0000-0000-000000000001", - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001", - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001" - }, - "relationships": { - "area": {}, - "assignees": {}, - "baseType": { - "data": { - "id": "00000000-0000-0000-0000-000000000002", - "type": "workitemtypes" - }, - "links": { - "self": "http:///api/workitemtypes/00000000-0000-0000-0000-000000000002" - } - }, - "children": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/children" - }, - "meta": { - "hasChildren": false - } - }, - "comments": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/comments", - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001/relationships/comments" - } - }, - "creator": { - "data": { - "id": "00000000-0000-0000-0000-000000000003", - "type": "users" - }, - "links": { - "related": "http:///api/users/00000000-0000-0000-0000-000000000003", - "self": "http:///api/users/00000000-0000-0000-0000-000000000003" - } - }, - "events": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/events" - } - }, - "iteration": {}, - "labels": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/labels" - } - }, - "space": { - "data": { - "id": "00000000-0000-0000-0000-000000000004", - "type": "spaces" - }, - "links": { - "related": "http:///api/spaces/00000000-0000-0000-0000-000000000004", - "self": "http:///api/spaces/00000000-0000-0000-0000-000000000004" - } - }, - "system.boardcolumns": {}, - "workItemLinks": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/links" - } - } - }, - "type": "workitems" - }, - "links": { - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001" - } -} \ No newline at end of file +false \ No newline at end of file diff --git a/controller/test-files/work_item/update/codebase/valid_sample_1.res.payload.golden.json b/controller/test-files/work_item/update/codebase/valid_sample_1.res.payload.golden.json index 433a216e8f..90589251b1 100755 --- a/controller/test-files/work_item/update/codebase/valid_sample_1.res.payload.golden.json +++ b/controller/test-files/work_item/update/codebase/valid_sample_1.res.payload.golden.json @@ -1,95 +1 @@ -{ - "data": { - "attributes": { - "codebase_field": { - "repository": "git://github.com/pkg/error.git", - "branch": "master", - "filename": "main.go", - "linenumber": 15, - "codebaseid": "dunno" - }, - "system.created_at": "0001-01-01T00:00:00Z", - "system.metastate": null, - "system.number": 4, - "system.order": 4000, - "system.remote_item_id": null, - "system.state": "new", - "system.title": "codebase_wi", - "system.updated_at": "0001-01-01T00:00:00Z", - "version": 1 - }, - "id": "00000000-0000-0000-0000-000000000001", - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001", - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001" - }, - "relationships": { - "area": {}, - "assignees": {}, - "baseType": { - "data": { - "id": "00000000-0000-0000-0000-000000000002", - "type": "workitemtypes" - }, - "links": { - "self": "http:///api/workitemtypes/00000000-0000-0000-0000-000000000002" - } - }, - "children": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/children" - }, - "meta": { - "hasChildren": false - } - }, - "comments": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/comments", - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001/relationships/comments" - } - }, - "creator": { - "data": { - "id": "00000000-0000-0000-0000-000000000003", - "type": "users" - }, - "links": { - "related": "http:///api/users/00000000-0000-0000-0000-000000000003", - "self": "http:///api/users/00000000-0000-0000-0000-000000000003" - } - }, - "events": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/events" - } - }, - "iteration": {}, - "labels": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/labels" - } - }, - "space": { - "data": { - "id": "00000000-0000-0000-0000-000000000004", - "type": "spaces" - }, - "links": { - "related": "http:///api/spaces/00000000-0000-0000-0000-000000000004", - "self": "http:///api/spaces/00000000-0000-0000-0000-000000000004" - } - }, - "system.boardcolumns": {}, - "workItemLinks": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/links" - } - } - }, - "type": "workitems" - }, - "links": { - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001" - } -} \ No newline at end of file +{"branch":"master","codebaseid":"dunno","filename":"main.go","linenumber":15,"repository":"git://github.com/pkg/error.git"} \ No newline at end of file diff --git a/controller/test-files/work_item/update/duration/valid_sample_1.res.payload.golden.json b/controller/test-files/work_item/update/duration/valid_sample_1.res.payload.golden.json index d818e2d632..6fbca66e5a 100755 --- a/controller/test-files/work_item/update/duration/valid_sample_1.res.payload.golden.json +++ b/controller/test-files/work_item/update/duration/valid_sample_1.res.payload.golden.json @@ -1,89 +1 @@ -{ - "data": { - "attributes": { - "duration_field": 300000000, - "system.created_at": "0001-01-01T00:00:00Z", - "system.metastate": null, - "system.number": 5, - "system.order": 5000, - "system.remote_item_id": null, - "system.state": "new", - "system.title": "duration_wi", - "system.updated_at": "0001-01-01T00:00:00Z", - "version": 1 - }, - "id": "00000000-0000-0000-0000-000000000001", - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001", - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001" - }, - "relationships": { - "area": {}, - "assignees": {}, - "baseType": { - "data": { - "id": "00000000-0000-0000-0000-000000000002", - "type": "workitemtypes" - }, - "links": { - "self": "http:///api/workitemtypes/00000000-0000-0000-0000-000000000002" - } - }, - "children": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/children" - }, - "meta": { - "hasChildren": false - } - }, - "comments": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/comments", - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001/relationships/comments" - } - }, - "creator": { - "data": { - "id": "00000000-0000-0000-0000-000000000003", - "type": "users" - }, - "links": { - "related": "http:///api/users/00000000-0000-0000-0000-000000000003", - "self": "http:///api/users/00000000-0000-0000-0000-000000000003" - } - }, - "events": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/events" - } - }, - "iteration": {}, - "labels": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/labels" - } - }, - "space": { - "data": { - "id": "00000000-0000-0000-0000-000000000004", - "type": "spaces" - }, - "links": { - "related": "http:///api/spaces/00000000-0000-0000-0000-000000000004", - "self": "http:///api/spaces/00000000-0000-0000-0000-000000000004" - } - }, - "system.boardcolumns": {}, - "workItemLinks": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/links" - } - } - }, - "type": "workitems" - }, - "links": { - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001" - } -} \ No newline at end of file +300000000 \ No newline at end of file diff --git a/controller/test-files/work_item/update/duration/valid_sample_2.res.payload.golden.json b/controller/test-files/work_item/update/duration/valid_sample_2.res.payload.golden.json index 04b18ce4be..01aa508ea1 100755 --- a/controller/test-files/work_item/update/duration/valid_sample_2.res.payload.golden.json +++ b/controller/test-files/work_item/update/duration/valid_sample_2.res.payload.golden.json @@ -1,89 +1 @@ -{ - "data": { - "attributes": { - "duration_field": -5400000000000, - "system.created_at": "0001-01-01T00:00:00Z", - "system.metastate": null, - "system.number": 5, - "system.order": 5000, - "system.remote_item_id": null, - "system.state": "new", - "system.title": "duration_wi", - "system.updated_at": "0001-01-01T00:00:00Z", - "version": 2 - }, - "id": "00000000-0000-0000-0000-000000000001", - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001", - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001" - }, - "relationships": { - "area": {}, - "assignees": {}, - "baseType": { - "data": { - "id": "00000000-0000-0000-0000-000000000002", - "type": "workitemtypes" - }, - "links": { - "self": "http:///api/workitemtypes/00000000-0000-0000-0000-000000000002" - } - }, - "children": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/children" - }, - "meta": { - "hasChildren": false - } - }, - "comments": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/comments", - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001/relationships/comments" - } - }, - "creator": { - "data": { - "id": "00000000-0000-0000-0000-000000000003", - "type": "users" - }, - "links": { - "related": "http:///api/users/00000000-0000-0000-0000-000000000003", - "self": "http:///api/users/00000000-0000-0000-0000-000000000003" - } - }, - "events": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/events" - } - }, - "iteration": {}, - "labels": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/labels" - } - }, - "space": { - "data": { - "id": "00000000-0000-0000-0000-000000000004", - "type": "spaces" - }, - "links": { - "related": "http:///api/spaces/00000000-0000-0000-0000-000000000004", - "self": "http:///api/spaces/00000000-0000-0000-0000-000000000004" - } - }, - "system.boardcolumns": {}, - "workItemLinks": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/links" - } - } - }, - "type": "workitems" - }, - "links": { - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001" - } -} \ No newline at end of file +-5400000000000 \ No newline at end of file diff --git a/controller/test-files/work_item/update/float/valid_sample_1.res.payload.golden.json b/controller/test-files/work_item/update/float/valid_sample_1.res.payload.golden.json index 7eaff9e31f..475dc2a181 100755 --- a/controller/test-files/work_item/update/float/valid_sample_1.res.payload.golden.json +++ b/controller/test-files/work_item/update/float/valid_sample_1.res.payload.golden.json @@ -1,89 +1 @@ -{ - "data": { - "attributes": { - "float_field": -1111.1, - "system.created_at": "0001-01-01T00:00:00Z", - "system.metastate": null, - "system.number": 6, - "system.order": 6000, - "system.remote_item_id": null, - "system.state": "new", - "system.title": "float_wi", - "system.updated_at": "0001-01-01T00:00:00Z", - "version": 1 - }, - "id": "00000000-0000-0000-0000-000000000001", - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001", - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001" - }, - "relationships": { - "area": {}, - "assignees": {}, - "baseType": { - "data": { - "id": "00000000-0000-0000-0000-000000000002", - "type": "workitemtypes" - }, - "links": { - "self": "http:///api/workitemtypes/00000000-0000-0000-0000-000000000002" - } - }, - "children": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/children" - }, - "meta": { - "hasChildren": false - } - }, - "comments": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/comments", - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001/relationships/comments" - } - }, - "creator": { - "data": { - "id": "00000000-0000-0000-0000-000000000003", - "type": "users" - }, - "links": { - "related": "http:///api/users/00000000-0000-0000-0000-000000000003", - "self": "http:///api/users/00000000-0000-0000-0000-000000000003" - } - }, - "events": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/events" - } - }, - "iteration": {}, - "labels": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/labels" - } - }, - "space": { - "data": { - "id": "00000000-0000-0000-0000-000000000004", - "type": "spaces" - }, - "links": { - "related": "http:///api/spaces/00000000-0000-0000-0000-000000000004", - "self": "http:///api/spaces/00000000-0000-0000-0000-000000000004" - } - }, - "system.boardcolumns": {}, - "workItemLinks": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/links" - } - } - }, - "type": "workitems" - }, - "links": { - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001" - } -} \ No newline at end of file +-1111.1 \ No newline at end of file diff --git a/controller/test-files/work_item/update/float/valid_sample_2.res.payload.golden.json b/controller/test-files/work_item/update/float/valid_sample_2.res.payload.golden.json index 3225056d12..107774515e 100755 --- a/controller/test-files/work_item/update/float/valid_sample_2.res.payload.golden.json +++ b/controller/test-files/work_item/update/float/valid_sample_2.res.payload.golden.json @@ -1,89 +1 @@ -{ - "data": { - "attributes": { - "float_field": 555.2, - "system.created_at": "0001-01-01T00:00:00Z", - "system.metastate": null, - "system.number": 6, - "system.order": 6000, - "system.remote_item_id": null, - "system.state": "new", - "system.title": "float_wi", - "system.updated_at": "0001-01-01T00:00:00Z", - "version": 2 - }, - "id": "00000000-0000-0000-0000-000000000001", - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001", - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001" - }, - "relationships": { - "area": {}, - "assignees": {}, - "baseType": { - "data": { - "id": "00000000-0000-0000-0000-000000000002", - "type": "workitemtypes" - }, - "links": { - "self": "http:///api/workitemtypes/00000000-0000-0000-0000-000000000002" - } - }, - "children": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/children" - }, - "meta": { - "hasChildren": false - } - }, - "comments": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/comments", - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001/relationships/comments" - } - }, - "creator": { - "data": { - "id": "00000000-0000-0000-0000-000000000003", - "type": "users" - }, - "links": { - "related": "http:///api/users/00000000-0000-0000-0000-000000000003", - "self": "http:///api/users/00000000-0000-0000-0000-000000000003" - } - }, - "events": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/events" - } - }, - "iteration": {}, - "labels": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/labels" - } - }, - "space": { - "data": { - "id": "00000000-0000-0000-0000-000000000004", - "type": "spaces" - }, - "links": { - "related": "http:///api/spaces/00000000-0000-0000-0000-000000000004", - "self": "http:///api/spaces/00000000-0000-0000-0000-000000000004" - } - }, - "system.boardcolumns": {}, - "workItemLinks": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/links" - } - } - }, - "type": "workitems" - }, - "links": { - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001" - } -} \ No newline at end of file +555.2 \ No newline at end of file diff --git a/controller/test-files/work_item/update/instant/valid_sample_1.res.payload.golden.json b/controller/test-files/work_item/update/instant/valid_sample_1.res.payload.golden.json index 3dc9acba48..0b328c61bf 100755 --- a/controller/test-files/work_item/update/instant/valid_sample_1.res.payload.golden.json +++ b/controller/test-files/work_item/update/instant/valid_sample_1.res.payload.golden.json @@ -1,89 +1 @@ -{ - "data": { - "attributes": { - "instant_field": "0001-01-01T00:00:00Z", - "system.created_at": "0001-01-01T00:00:00Z", - "system.metastate": null, - "system.number": 7, - "system.order": 7000, - "system.remote_item_id": null, - "system.state": "new", - "system.title": "instant_wi", - "system.updated_at": "0001-01-01T00:00:00Z", - "version": 1 - }, - "id": "00000000-0000-0000-0000-000000000001", - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001", - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001" - }, - "relationships": { - "area": {}, - "assignees": {}, - "baseType": { - "data": { - "id": "00000000-0000-0000-0000-000000000002", - "type": "workitemtypes" - }, - "links": { - "self": "http:///api/workitemtypes/00000000-0000-0000-0000-000000000002" - } - }, - "children": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/children" - }, - "meta": { - "hasChildren": false - } - }, - "comments": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/comments", - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001/relationships/comments" - } - }, - "creator": { - "data": { - "id": "00000000-0000-0000-0000-000000000003", - "type": "users" - }, - "links": { - "related": "http:///api/users/00000000-0000-0000-0000-000000000003", - "self": "http:///api/users/00000000-0000-0000-0000-000000000003" - } - }, - "events": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/events" - } - }, - "iteration": {}, - "labels": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/labels" - } - }, - "space": { - "data": { - "id": "00000000-0000-0000-0000-000000000004", - "type": "spaces" - }, - "links": { - "related": "http:///api/spaces/00000000-0000-0000-0000-000000000004", - "self": "http:///api/spaces/00000000-0000-0000-0000-000000000004" - } - }, - "system.boardcolumns": {}, - "workItemLinks": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/links" - } - } - }, - "type": "workitems" - }, - "links": { - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001" - } -} \ No newline at end of file +"0001-01-01T00:00:00Z" \ No newline at end of file diff --git a/controller/test-files/work_item/update/integer/valid_sample_1.res.payload.golden.json b/controller/test-files/work_item/update/integer/valid_sample_1.res.payload.golden.json index b751f0c603..4f37670799 100755 --- a/controller/test-files/work_item/update/integer/valid_sample_1.res.payload.golden.json +++ b/controller/test-files/work_item/update/integer/valid_sample_1.res.payload.golden.json @@ -1,89 +1 @@ -{ - "data": { - "attributes": { - "integer_field": 333, - "system.created_at": "0001-01-01T00:00:00Z", - "system.metastate": null, - "system.number": 8, - "system.order": 8000, - "system.remote_item_id": null, - "system.state": "new", - "system.title": "integer_wi", - "system.updated_at": "0001-01-01T00:00:00Z", - "version": 1 - }, - "id": "00000000-0000-0000-0000-000000000001", - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001", - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001" - }, - "relationships": { - "area": {}, - "assignees": {}, - "baseType": { - "data": { - "id": "00000000-0000-0000-0000-000000000002", - "type": "workitemtypes" - }, - "links": { - "self": "http:///api/workitemtypes/00000000-0000-0000-0000-000000000002" - } - }, - "children": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/children" - }, - "meta": { - "hasChildren": false - } - }, - "comments": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/comments", - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001/relationships/comments" - } - }, - "creator": { - "data": { - "id": "00000000-0000-0000-0000-000000000003", - "type": "users" - }, - "links": { - "related": "http:///api/users/00000000-0000-0000-0000-000000000003", - "self": "http:///api/users/00000000-0000-0000-0000-000000000003" - } - }, - "events": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/events" - } - }, - "iteration": {}, - "labels": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/labels" - } - }, - "space": { - "data": { - "id": "00000000-0000-0000-0000-000000000004", - "type": "spaces" - }, - "links": { - "related": "http:///api/spaces/00000000-0000-0000-0000-000000000004", - "self": "http:///api/spaces/00000000-0000-0000-0000-000000000004" - } - }, - "system.boardcolumns": {}, - "workItemLinks": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/links" - } - } - }, - "type": "workitems" - }, - "links": { - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001" - } -} \ No newline at end of file +333 \ No newline at end of file diff --git a/controller/test-files/work_item/update/integer/valid_sample_2.res.payload.golden.json b/controller/test-files/work_item/update/integer/valid_sample_2.res.payload.golden.json index c70334c63e..32676ca69f 100755 --- a/controller/test-files/work_item/update/integer/valid_sample_2.res.payload.golden.json +++ b/controller/test-files/work_item/update/integer/valid_sample_2.res.payload.golden.json @@ -1,89 +1 @@ -{ - "data": { - "attributes": { - "integer_field": -100, - "system.created_at": "0001-01-01T00:00:00Z", - "system.metastate": null, - "system.number": 8, - "system.order": 8000, - "system.remote_item_id": null, - "system.state": "new", - "system.title": "integer_wi", - "system.updated_at": "0001-01-01T00:00:00Z", - "version": 2 - }, - "id": "00000000-0000-0000-0000-000000000001", - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001", - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001" - }, - "relationships": { - "area": {}, - "assignees": {}, - "baseType": { - "data": { - "id": "00000000-0000-0000-0000-000000000002", - "type": "workitemtypes" - }, - "links": { - "self": "http:///api/workitemtypes/00000000-0000-0000-0000-000000000002" - } - }, - "children": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/children" - }, - "meta": { - "hasChildren": false - } - }, - "comments": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/comments", - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001/relationships/comments" - } - }, - "creator": { - "data": { - "id": "00000000-0000-0000-0000-000000000003", - "type": "users" - }, - "links": { - "related": "http:///api/users/00000000-0000-0000-0000-000000000003", - "self": "http:///api/users/00000000-0000-0000-0000-000000000003" - } - }, - "events": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/events" - } - }, - "iteration": {}, - "labels": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/labels" - } - }, - "space": { - "data": { - "id": "00000000-0000-0000-0000-000000000004", - "type": "spaces" - }, - "links": { - "related": "http:///api/spaces/00000000-0000-0000-0000-000000000004", - "self": "http:///api/spaces/00000000-0000-0000-0000-000000000004" - } - }, - "system.boardcolumns": {}, - "workItemLinks": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/links" - } - } - }, - "type": "workitems" - }, - "links": { - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001" - } -} \ No newline at end of file +-100 \ No newline at end of file diff --git a/controller/test-files/work_item/update/iteration/valid_sample_1.res.payload.golden.json b/controller/test-files/work_item/update/iteration/valid_sample_1.res.payload.golden.json index 2765e10eae..1d027b2c4c 100755 --- a/controller/test-files/work_item/update/iteration/valid_sample_1.res.payload.golden.json +++ b/controller/test-files/work_item/update/iteration/valid_sample_1.res.payload.golden.json @@ -1,89 +1 @@ -{ - "data": { - "attributes": { - "iteration_field": "00000000-0000-0000-0000-000000000001", - "system.created_at": "0001-01-01T00:00:00Z", - "system.metastate": null, - "system.number": 9, - "system.order": 9000, - "system.remote_item_id": null, - "system.state": "new", - "system.title": "iteration_wi", - "system.updated_at": "0001-01-01T00:00:00Z", - "version": 1 - }, - "id": "00000000-0000-0000-0000-000000000002", - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000002", - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000002" - }, - "relationships": { - "area": {}, - "assignees": {}, - "baseType": { - "data": { - "id": "00000000-0000-0000-0000-000000000003", - "type": "workitemtypes" - }, - "links": { - "self": "http:///api/workitemtypes/00000000-0000-0000-0000-000000000003" - } - }, - "children": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000002/children" - }, - "meta": { - "hasChildren": false - } - }, - "comments": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000002/comments", - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000002/relationships/comments" - } - }, - "creator": { - "data": { - "id": "00000000-0000-0000-0000-000000000004", - "type": "users" - }, - "links": { - "related": "http:///api/users/00000000-0000-0000-0000-000000000004", - "self": "http:///api/users/00000000-0000-0000-0000-000000000004" - } - }, - "events": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000002/events" - } - }, - "iteration": {}, - "labels": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000002/labels" - } - }, - "space": { - "data": { - "id": "00000000-0000-0000-0000-000000000005", - "type": "spaces" - }, - "links": { - "related": "http:///api/spaces/00000000-0000-0000-0000-000000000005", - "self": "http:///api/spaces/00000000-0000-0000-0000-000000000005" - } - }, - "system.boardcolumns": {}, - "workItemLinks": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000002/links" - } - } - }, - "type": "workitems" - }, - "links": { - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000002" - } -} \ No newline at end of file +"00000000-0000-0000-0000-000000000001" \ No newline at end of file diff --git a/controller/test-files/work_item/update/iteration/valid_sample_2.res.payload.golden.json b/controller/test-files/work_item/update/iteration/valid_sample_2.res.payload.golden.json index 8d6e7f010b..3cc762b550 100755 --- a/controller/test-files/work_item/update/iteration/valid_sample_2.res.payload.golden.json +++ b/controller/test-files/work_item/update/iteration/valid_sample_2.res.payload.golden.json @@ -1,89 +1 @@ -{ - "data": { - "attributes": { - "iteration_field": "", - "system.created_at": "0001-01-01T00:00:00Z", - "system.metastate": null, - "system.number": 9, - "system.order": 9000, - "system.remote_item_id": null, - "system.state": "new", - "system.title": "iteration_wi", - "system.updated_at": "0001-01-01T00:00:00Z", - "version": 2 - }, - "id": "00000000-0000-0000-0000-000000000001", - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001", - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001" - }, - "relationships": { - "area": {}, - "assignees": {}, - "baseType": { - "data": { - "id": "00000000-0000-0000-0000-000000000002", - "type": "workitemtypes" - }, - "links": { - "self": "http:///api/workitemtypes/00000000-0000-0000-0000-000000000002" - } - }, - "children": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/children" - }, - "meta": { - "hasChildren": false - } - }, - "comments": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/comments", - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001/relationships/comments" - } - }, - "creator": { - "data": { - "id": "00000000-0000-0000-0000-000000000003", - "type": "users" - }, - "links": { - "related": "http:///api/users/00000000-0000-0000-0000-000000000003", - "self": "http:///api/users/00000000-0000-0000-0000-000000000003" - } - }, - "events": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/events" - } - }, - "iteration": {}, - "labels": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/labels" - } - }, - "space": { - "data": { - "id": "00000000-0000-0000-0000-000000000004", - "type": "spaces" - }, - "links": { - "related": "http:///api/spaces/00000000-0000-0000-0000-000000000004", - "self": "http:///api/spaces/00000000-0000-0000-0000-000000000004" - } - }, - "system.boardcolumns": {}, - "workItemLinks": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/links" - } - } - }, - "type": "workitems" - }, - "links": { - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001" - } -} \ No newline at end of file +"" \ No newline at end of file diff --git a/controller/test-files/work_item/update/label/valid_sample_1.res.payload.golden.json b/controller/test-files/work_item/update/label/valid_sample_1.res.payload.golden.json index ef6730fa3b..1d027b2c4c 100755 --- a/controller/test-files/work_item/update/label/valid_sample_1.res.payload.golden.json +++ b/controller/test-files/work_item/update/label/valid_sample_1.res.payload.golden.json @@ -1,89 +1 @@ -{ - "data": { - "attributes": { - "label_field": "00000000-0000-0000-0000-000000000001", - "system.created_at": "0001-01-01T00:00:00Z", - "system.metastate": null, - "system.number": 10, - "system.order": 10000, - "system.remote_item_id": null, - "system.state": "new", - "system.title": "label_wi", - "system.updated_at": "0001-01-01T00:00:00Z", - "version": 1 - }, - "id": "00000000-0000-0000-0000-000000000002", - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000002", - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000002" - }, - "relationships": { - "area": {}, - "assignees": {}, - "baseType": { - "data": { - "id": "00000000-0000-0000-0000-000000000003", - "type": "workitemtypes" - }, - "links": { - "self": "http:///api/workitemtypes/00000000-0000-0000-0000-000000000003" - } - }, - "children": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000002/children" - }, - "meta": { - "hasChildren": false - } - }, - "comments": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000002/comments", - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000002/relationships/comments" - } - }, - "creator": { - "data": { - "id": "00000000-0000-0000-0000-000000000004", - "type": "users" - }, - "links": { - "related": "http:///api/users/00000000-0000-0000-0000-000000000004", - "self": "http:///api/users/00000000-0000-0000-0000-000000000004" - } - }, - "events": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000002/events" - } - }, - "iteration": {}, - "labels": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000002/labels" - } - }, - "space": { - "data": { - "id": "00000000-0000-0000-0000-000000000005", - "type": "spaces" - }, - "links": { - "related": "http:///api/spaces/00000000-0000-0000-0000-000000000005", - "self": "http:///api/spaces/00000000-0000-0000-0000-000000000005" - } - }, - "system.boardcolumns": {}, - "workItemLinks": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000002/links" - } - } - }, - "type": "workitems" - }, - "links": { - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000002" - } -} \ No newline at end of file +"00000000-0000-0000-0000-000000000001" \ No newline at end of file diff --git a/controller/test-files/work_item/update/label/valid_sample_2.res.payload.golden.json b/controller/test-files/work_item/update/label/valid_sample_2.res.payload.golden.json index 6f3c4cb7b3..3cc762b550 100755 --- a/controller/test-files/work_item/update/label/valid_sample_2.res.payload.golden.json +++ b/controller/test-files/work_item/update/label/valid_sample_2.res.payload.golden.json @@ -1,89 +1 @@ -{ - "data": { - "attributes": { - "label_field": "", - "system.created_at": "0001-01-01T00:00:00Z", - "system.metastate": null, - "system.number": 10, - "system.order": 10000, - "system.remote_item_id": null, - "system.state": "new", - "system.title": "label_wi", - "system.updated_at": "0001-01-01T00:00:00Z", - "version": 2 - }, - "id": "00000000-0000-0000-0000-000000000001", - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001", - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001" - }, - "relationships": { - "area": {}, - "assignees": {}, - "baseType": { - "data": { - "id": "00000000-0000-0000-0000-000000000002", - "type": "workitemtypes" - }, - "links": { - "self": "http:///api/workitemtypes/00000000-0000-0000-0000-000000000002" - } - }, - "children": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/children" - }, - "meta": { - "hasChildren": false - } - }, - "comments": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/comments", - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001/relationships/comments" - } - }, - "creator": { - "data": { - "id": "00000000-0000-0000-0000-000000000003", - "type": "users" - }, - "links": { - "related": "http:///api/users/00000000-0000-0000-0000-000000000003", - "self": "http:///api/users/00000000-0000-0000-0000-000000000003" - } - }, - "events": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/events" - } - }, - "iteration": {}, - "labels": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/labels" - } - }, - "space": { - "data": { - "id": "00000000-0000-0000-0000-000000000004", - "type": "spaces" - }, - "links": { - "related": "http:///api/spaces/00000000-0000-0000-0000-000000000004", - "self": "http:///api/spaces/00000000-0000-0000-0000-000000000004" - } - }, - "system.boardcolumns": {}, - "workItemLinks": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/links" - } - } - }, - "type": "workitems" - }, - "links": { - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001" - } -} \ No newline at end of file +"" \ No newline at end of file diff --git a/controller/test-files/work_item/update/markup/valid_sample_1.res.payload.golden.json b/controller/test-files/work_item/update/markup/valid_sample_1.res.payload.golden.json index a9e9d889af..a0ee5eda0a 100755 --- a/controller/test-files/work_item/update/markup/valid_sample_1.res.payload.golden.json +++ b/controller/test-files/work_item/update/markup/valid_sample_1.res.payload.golden.json @@ -1,92 +1 @@ -{ - "data": { - "attributes": { - "markup_field": { - "content": "default", - "markup": "PlainText" - }, - "system.created_at": "0001-01-01T00:00:00Z", - "system.metastate": null, - "system.number": 11, - "system.order": 11000, - "system.remote_item_id": null, - "system.state": "new", - "system.title": "markup_wi", - "system.updated_at": "0001-01-01T00:00:00Z", - "version": 1 - }, - "id": "00000000-0000-0000-0000-000000000001", - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001", - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001" - }, - "relationships": { - "area": {}, - "assignees": {}, - "baseType": { - "data": { - "id": "00000000-0000-0000-0000-000000000002", - "type": "workitemtypes" - }, - "links": { - "self": "http:///api/workitemtypes/00000000-0000-0000-0000-000000000002" - } - }, - "children": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/children" - }, - "meta": { - "hasChildren": false - } - }, - "comments": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/comments", - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001/relationships/comments" - } - }, - "creator": { - "data": { - "id": "00000000-0000-0000-0000-000000000003", - "type": "users" - }, - "links": { - "related": "http:///api/users/00000000-0000-0000-0000-000000000003", - "self": "http:///api/users/00000000-0000-0000-0000-000000000003" - } - }, - "events": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/events" - } - }, - "iteration": {}, - "labels": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/labels" - } - }, - "space": { - "data": { - "id": "00000000-0000-0000-0000-000000000004", - "type": "spaces" - }, - "links": { - "related": "http:///api/spaces/00000000-0000-0000-0000-000000000004", - "self": "http:///api/spaces/00000000-0000-0000-0000-000000000004" - } - }, - "system.boardcolumns": {}, - "workItemLinks": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/links" - } - } - }, - "type": "workitems" - }, - "links": { - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001" - } -} \ No newline at end of file +{"content":"default","markup":"PlainText"} \ No newline at end of file diff --git a/controller/test-files/work_item/update/markup/valid_sample_2.res.payload.golden.json b/controller/test-files/work_item/update/markup/valid_sample_2.res.payload.golden.json index b96867d2b5..4d660b9d00 100755 --- a/controller/test-files/work_item/update/markup/valid_sample_2.res.payload.golden.json +++ b/controller/test-files/work_item/update/markup/valid_sample_2.res.payload.golden.json @@ -1,92 +1 @@ -{ - "data": { - "attributes": { - "markup_field": { - "content": "# markdown", - "markup": "Markdown" - }, - "system.created_at": "0001-01-01T00:00:00Z", - "system.metastate": null, - "system.number": 11, - "system.order": 11000, - "system.remote_item_id": null, - "system.state": "new", - "system.title": "markup_wi", - "system.updated_at": "0001-01-01T00:00:00Z", - "version": 2 - }, - "id": "00000000-0000-0000-0000-000000000001", - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001", - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001" - }, - "relationships": { - "area": {}, - "assignees": {}, - "baseType": { - "data": { - "id": "00000000-0000-0000-0000-000000000002", - "type": "workitemtypes" - }, - "links": { - "self": "http:///api/workitemtypes/00000000-0000-0000-0000-000000000002" - } - }, - "children": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/children" - }, - "meta": { - "hasChildren": false - } - }, - "comments": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/comments", - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001/relationships/comments" - } - }, - "creator": { - "data": { - "id": "00000000-0000-0000-0000-000000000003", - "type": "users" - }, - "links": { - "related": "http:///api/users/00000000-0000-0000-0000-000000000003", - "self": "http:///api/users/00000000-0000-0000-0000-000000000003" - } - }, - "events": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/events" - } - }, - "iteration": {}, - "labels": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/labels" - } - }, - "space": { - "data": { - "id": "00000000-0000-0000-0000-000000000004", - "type": "spaces" - }, - "links": { - "related": "http:///api/spaces/00000000-0000-0000-0000-000000000004", - "self": "http:///api/spaces/00000000-0000-0000-0000-000000000004" - } - }, - "system.boardcolumns": {}, - "workItemLinks": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/links" - } - } - }, - "type": "workitems" - }, - "links": { - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001" - } -} \ No newline at end of file +{"content":"# markdown","markup":"Markdown"} \ No newline at end of file diff --git a/controller/test-files/work_item/update/string/valid_sample_1.res.payload.golden.json b/controller/test-files/work_item/update/string/valid_sample_1.res.payload.golden.json index 991b2b7535..0252483ecb 100755 --- a/controller/test-files/work_item/update/string/valid_sample_1.res.payload.golden.json +++ b/controller/test-files/work_item/update/string/valid_sample_1.res.payload.golden.json @@ -1,89 +1 @@ -{ - "data": { - "attributes": { - "string_field": "bar", - "system.created_at": "0001-01-01T00:00:00Z", - "system.metastate": null, - "system.number": 12, - "system.order": 12000, - "system.remote_item_id": null, - "system.state": "new", - "system.title": "string_wi", - "system.updated_at": "0001-01-01T00:00:00Z", - "version": 1 - }, - "id": "00000000-0000-0000-0000-000000000001", - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001", - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001" - }, - "relationships": { - "area": {}, - "assignees": {}, - "baseType": { - "data": { - "id": "00000000-0000-0000-0000-000000000002", - "type": "workitemtypes" - }, - "links": { - "self": "http:///api/workitemtypes/00000000-0000-0000-0000-000000000002" - } - }, - "children": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/children" - }, - "meta": { - "hasChildren": false - } - }, - "comments": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/comments", - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001/relationships/comments" - } - }, - "creator": { - "data": { - "id": "00000000-0000-0000-0000-000000000003", - "type": "users" - }, - "links": { - "related": "http:///api/users/00000000-0000-0000-0000-000000000003", - "self": "http:///api/users/00000000-0000-0000-0000-000000000003" - } - }, - "events": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/events" - } - }, - "iteration": {}, - "labels": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/labels" - } - }, - "space": { - "data": { - "id": "00000000-0000-0000-0000-000000000004", - "type": "spaces" - }, - "links": { - "related": "http:///api/spaces/00000000-0000-0000-0000-000000000004", - "self": "http:///api/spaces/00000000-0000-0000-0000-000000000004" - } - }, - "system.boardcolumns": {}, - "workItemLinks": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/links" - } - } - }, - "type": "workitems" - }, - "links": { - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001" - } -} \ No newline at end of file +"bar" \ No newline at end of file diff --git a/controller/test-files/work_item/update/url/valid_sample_1.res.payload.golden.json b/controller/test-files/work_item/update/url/valid_sample_1.res.payload.golden.json index ba9847b4f3..8e775b1375 100755 --- a/controller/test-files/work_item/update/url/valid_sample_1.res.payload.golden.json +++ b/controller/test-files/work_item/update/url/valid_sample_1.res.payload.golden.json @@ -1,89 +1 @@ -{ - "data": { - "attributes": { - "system.created_at": "0001-01-01T00:00:00Z", - "system.metastate": null, - "system.number": 13, - "system.order": 13000, - "system.remote_item_id": null, - "system.state": "new", - "system.title": "url_wi", - "system.updated_at": "0001-01-01T00:00:00Z", - "url_field": "http://www.openshift.io", - "version": 1 - }, - "id": "00000000-0000-0000-0000-000000000001", - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001", - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001" - }, - "relationships": { - "area": {}, - "assignees": {}, - "baseType": { - "data": { - "id": "00000000-0000-0000-0000-000000000002", - "type": "workitemtypes" - }, - "links": { - "self": "http:///api/workitemtypes/00000000-0000-0000-0000-000000000002" - } - }, - "children": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/children" - }, - "meta": { - "hasChildren": false - } - }, - "comments": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/comments", - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001/relationships/comments" - } - }, - "creator": { - "data": { - "id": "00000000-0000-0000-0000-000000000003", - "type": "users" - }, - "links": { - "related": "http:///api/users/00000000-0000-0000-0000-000000000003", - "self": "http:///api/users/00000000-0000-0000-0000-000000000003" - } - }, - "events": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/events" - } - }, - "iteration": {}, - "labels": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/labels" - } - }, - "space": { - "data": { - "id": "00000000-0000-0000-0000-000000000004", - "type": "spaces" - }, - "links": { - "related": "http:///api/spaces/00000000-0000-0000-0000-000000000004", - "self": "http:///api/spaces/00000000-0000-0000-0000-000000000004" - } - }, - "system.boardcolumns": {}, - "workItemLinks": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/links" - } - } - }, - "type": "workitems" - }, - "links": { - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001" - } -} \ No newline at end of file +"http://www.openshift.io" \ No newline at end of file diff --git a/controller/test-files/work_item/update/url/valid_sample_2.res.payload.golden.json b/controller/test-files/work_item/update/url/valid_sample_2.res.payload.golden.json index ec6956b7cf..49fa4f18c6 100755 --- a/controller/test-files/work_item/update/url/valid_sample_2.res.payload.golden.json +++ b/controller/test-files/work_item/update/url/valid_sample_2.res.payload.golden.json @@ -1,89 +1 @@ -{ - "data": { - "attributes": { - "system.created_at": "0001-01-01T00:00:00Z", - "system.metastate": null, - "system.number": 13, - "system.order": 13000, - "system.remote_item_id": null, - "system.state": "new", - "system.title": "url_wi", - "system.updated_at": "0001-01-01T00:00:00Z", - "url_field": "openshift.io", - "version": 2 - }, - "id": "00000000-0000-0000-0000-000000000001", - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001", - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001" - }, - "relationships": { - "area": {}, - "assignees": {}, - "baseType": { - "data": { - "id": "00000000-0000-0000-0000-000000000002", - "type": "workitemtypes" - }, - "links": { - "self": "http:///api/workitemtypes/00000000-0000-0000-0000-000000000002" - } - }, - "children": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/children" - }, - "meta": { - "hasChildren": false - } - }, - "comments": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/comments", - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001/relationships/comments" - } - }, - "creator": { - "data": { - "id": "00000000-0000-0000-0000-000000000003", - "type": "users" - }, - "links": { - "related": "http:///api/users/00000000-0000-0000-0000-000000000003", - "self": "http:///api/users/00000000-0000-0000-0000-000000000003" - } - }, - "events": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/events" - } - }, - "iteration": {}, - "labels": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/labels" - } - }, - "space": { - "data": { - "id": "00000000-0000-0000-0000-000000000004", - "type": "spaces" - }, - "links": { - "related": "http:///api/spaces/00000000-0000-0000-0000-000000000004", - "self": "http:///api/spaces/00000000-0000-0000-0000-000000000004" - } - }, - "system.boardcolumns": {}, - "workItemLinks": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/links" - } - } - }, - "type": "workitems" - }, - "links": { - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001" - } -} \ No newline at end of file +"openshift.io" \ No newline at end of file diff --git a/controller/test-files/work_item/update/url/valid_sample_3.res.payload.golden.json b/controller/test-files/work_item/update/url/valid_sample_3.res.payload.golden.json index 80d18b6bee..d674525df0 100755 --- a/controller/test-files/work_item/update/url/valid_sample_3.res.payload.golden.json +++ b/controller/test-files/work_item/update/url/valid_sample_3.res.payload.golden.json @@ -1,89 +1 @@ -{ - "data": { - "attributes": { - "system.created_at": "0001-01-01T00:00:00Z", - "system.metastate": null, - "system.number": 13, - "system.order": 13000, - "system.remote_item_id": null, - "system.state": "new", - "system.title": "url_wi", - "system.updated_at": "0001-01-01T00:00:00Z", - "url_field": "ftp://url.with.port.and.different.protocol.port.and.parameters.com:8080/fooo?arg=bar\u0026key=value", - "version": 3 - }, - "id": "00000000-0000-0000-0000-000000000001", - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001", - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001" - }, - "relationships": { - "area": {}, - "assignees": {}, - "baseType": { - "data": { - "id": "00000000-0000-0000-0000-000000000002", - "type": "workitemtypes" - }, - "links": { - "self": "http:///api/workitemtypes/00000000-0000-0000-0000-000000000002" - } - }, - "children": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/children" - }, - "meta": { - "hasChildren": false - } - }, - "comments": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/comments", - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001/relationships/comments" - } - }, - "creator": { - "data": { - "id": "00000000-0000-0000-0000-000000000003", - "type": "users" - }, - "links": { - "related": "http:///api/users/00000000-0000-0000-0000-000000000003", - "self": "http:///api/users/00000000-0000-0000-0000-000000000003" - } - }, - "events": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/events" - } - }, - "iteration": {}, - "labels": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/labels" - } - }, - "space": { - "data": { - "id": "00000000-0000-0000-0000-000000000004", - "type": "spaces" - }, - "links": { - "related": "http:///api/spaces/00000000-0000-0000-0000-000000000004", - "self": "http:///api/spaces/00000000-0000-0000-0000-000000000004" - } - }, - "system.boardcolumns": {}, - "workItemLinks": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/links" - } - } - }, - "type": "workitems" - }, - "links": { - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001" - } -} \ No newline at end of file +"ftp://url.with.port.and.different.protocol.port.and.parameters.com:8080/fooo?arg=bar\u0026key=value" \ No newline at end of file diff --git a/controller/test-files/work_item/update/user/valid_sample_1.res.payload.golden.json b/controller/test-files/work_item/update/user/valid_sample_1.res.payload.golden.json index 47beaf2887..0623c12278 100755 --- a/controller/test-files/work_item/update/user/valid_sample_1.res.payload.golden.json +++ b/controller/test-files/work_item/update/user/valid_sample_1.res.payload.golden.json @@ -1,89 +1 @@ -{ - "data": { - "attributes": { - "system.created_at": "0001-01-01T00:00:00Z", - "system.metastate": null, - "system.number": 14, - "system.order": 14000, - "system.remote_item_id": null, - "system.state": "new", - "system.title": "user_wi", - "system.updated_at": "0001-01-01T00:00:00Z", - "user_field": "john doe", - "version": 1 - }, - "id": "00000000-0000-0000-0000-000000000001", - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001", - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001" - }, - "relationships": { - "area": {}, - "assignees": {}, - "baseType": { - "data": { - "id": "00000000-0000-0000-0000-000000000002", - "type": "workitemtypes" - }, - "links": { - "self": "http:///api/workitemtypes/00000000-0000-0000-0000-000000000002" - } - }, - "children": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/children" - }, - "meta": { - "hasChildren": false - } - }, - "comments": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/comments", - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001/relationships/comments" - } - }, - "creator": { - "data": { - "id": "00000000-0000-0000-0000-000000000003", - "type": "users" - }, - "links": { - "related": "http:///api/users/00000000-0000-0000-0000-000000000003", - "self": "http:///api/users/00000000-0000-0000-0000-000000000003" - } - }, - "events": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/events" - } - }, - "iteration": {}, - "labels": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/labels" - } - }, - "space": { - "data": { - "id": "00000000-0000-0000-0000-000000000004", - "type": "spaces" - }, - "links": { - "related": "http:///api/spaces/00000000-0000-0000-0000-000000000004", - "self": "http:///api/spaces/00000000-0000-0000-0000-000000000004" - } - }, - "system.boardcolumns": {}, - "workItemLinks": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/links" - } - } - }, - "type": "workitems" - }, - "links": { - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001" - } -} \ No newline at end of file +"john doe" \ No newline at end of file diff --git a/controller/test-files/work_item/update/user/valid_sample_2.res.payload.golden.json b/controller/test-files/work_item/update/user/valid_sample_2.res.payload.golden.json index 0757d8184a..3cc762b550 100755 --- a/controller/test-files/work_item/update/user/valid_sample_2.res.payload.golden.json +++ b/controller/test-files/work_item/update/user/valid_sample_2.res.payload.golden.json @@ -1,89 +1 @@ -{ - "data": { - "attributes": { - "system.created_at": "0001-01-01T00:00:00Z", - "system.metastate": null, - "system.number": 14, - "system.order": 14000, - "system.remote_item_id": null, - "system.state": "new", - "system.title": "user_wi", - "system.updated_at": "0001-01-01T00:00:00Z", - "user_field": "", - "version": 2 - }, - "id": "00000000-0000-0000-0000-000000000001", - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001", - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001" - }, - "relationships": { - "area": {}, - "assignees": {}, - "baseType": { - "data": { - "id": "00000000-0000-0000-0000-000000000002", - "type": "workitemtypes" - }, - "links": { - "self": "http:///api/workitemtypes/00000000-0000-0000-0000-000000000002" - } - }, - "children": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/children" - }, - "meta": { - "hasChildren": false - } - }, - "comments": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/comments", - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001/relationships/comments" - } - }, - "creator": { - "data": { - "id": "00000000-0000-0000-0000-000000000003", - "type": "users" - }, - "links": { - "related": "http:///api/users/00000000-0000-0000-0000-000000000003", - "self": "http:///api/users/00000000-0000-0000-0000-000000000003" - } - }, - "events": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/events" - } - }, - "iteration": {}, - "labels": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/labels" - } - }, - "space": { - "data": { - "id": "00000000-0000-0000-0000-000000000004", - "type": "spaces" - }, - "links": { - "related": "http:///api/spaces/00000000-0000-0000-0000-000000000004", - "self": "http:///api/spaces/00000000-0000-0000-0000-000000000004" - } - }, - "system.boardcolumns": {}, - "workItemLinks": { - "links": { - "related": "http:///api/workitems/00000000-0000-0000-0000-000000000001/links" - } - } - }, - "type": "workitems" - }, - "links": { - "self": "http:///api/workitems/00000000-0000-0000-0000-000000000001" - } -} \ No newline at end of file +"" \ No newline at end of file diff --git a/controller/workitem_blackbox_test.go b/controller/workitem_blackbox_test.go index 3ca62f4198..0440c0106e 100644 --- a/controller/workitem_blackbox_test.go +++ b/controller/workitem_blackbox_test.go @@ -1039,7 +1039,7 @@ func (s *WorkItem2Suite) TestWI2UpdateFieldOfDifferentSimpleTypes() { // Update the work item res, updatedWI := test.UpdateWorkitemOK(t, s.svc.Context, s.svc, s.workitemCtrl, wi.ID, &u) // Check for updated value - compareWithGoldenAgnostic(t, filepath.Join(s.testDir, "update", kind.String(), fmt.Sprintf("valid_sample_%d", i)+".res.payload.golden.json"), updatedWI) + compareWithGoldenAgnostic(t, filepath.Join(s.testDir, "update", kind.String(), fmt.Sprintf("valid_sample_%d", i)+".res.payload.golden.json"), updatedWI, `$.data.attributes["`+kind.String()+`_field"]`) compareWithGoldenAgnostic(t, filepath.Join(s.testDir, "update", kind.String(), fmt.Sprintf("valid_sample_%d", i)+".res.headers.golden.json"), res.Header()) _, loadedWi := test.ShowWorkitemOK(t, s.svc.Context, s.svc, s.workitemCtrl, *updatedWI.Data.ID, nil, nil) require.NotNil(t, loadedWi)