Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
two-pass but it's only in testing
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
You can’t perform that action at this time.