Created
January 9, 2018 07:24
-
-
Save lusis/33d7b2ee3d9def95b3cb1c8b330c92c3 to your computer and use it in GitHub Desktop.
two-pass but it's only in testing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func TestSCMPluginForProjectResponseEnableImport(t *testing.T) { | |
obj := &SCMPluginForProjectResponse{} | |
// The test response file used here does NOT match the struct | |
data, dataErr := testdata.GetBytes(ListSCMPluginsResponseExportTestFile) | |
if dataErr != nil { | |
t.Fatalf(dataErr.Error()) | |
} | |
placeholder := make(map[string]interface{}) | |
_ = json.Unmarshal(data, &placeholder) | |
//err := obj.FromBytes(data) | |
decoder, newErr := mapstructure.NewDecoder(&mapstructure.DecoderConfig{ | |
ErrorUnused: true, | |
WeaklyTypedInput: false, | |
Result: obj, | |
TagName: "json", | |
}) | |
assert.NoError(t, newErr) | |
dErr := decoder.Decode(placeholder) | |
if dErr != nil { | |
t.Fatalf(dErr.Error()) | |
} | |
assert.Implements(t, (*VersionedResponse)(nil), obj) | |
//assert.NotNil(t, obj) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment