resources: Unify resource creation and kind setting

This removes the duplication of the kind string and cleans up things for
resource creation.
This commit is contained in:
James Shubin
2017-06-07 02:26:14 -04:00
parent 2f6c77fba2
commit b8ff6938df
30 changed files with 60 additions and 108 deletions

View File

@@ -42,6 +42,7 @@ func TestCompare2(t *testing.T) {
r1 := &NoopRes{
BaseRes: BaseRes{
Name: "noop1",
Kind: "noop",
MetaParams: MetaParams{
Noop: true,
},
@@ -49,7 +50,8 @@ func TestCompare2(t *testing.T) {
}
r2 := &NoopRes{
BaseRes: BaseRes{
Name: "noop1", // same nampe
Name: "noop1", // same name
Kind: "noop",
MetaParams: MetaParams{
Noop: false, // different noop
},
@@ -111,12 +113,9 @@ func TestMiscEncodeDecode1(t *testing.T) {
func TestMiscEncodeDecode2(t *testing.T) {
var err error
//gob.Register( &NoopRes{} ) // happens in noop.go : init()
//gob.Register( &FileRes{} ) // happens in file.go : init()
// ...
// encode
var input Res = &FileRes{}
input, _ := NewResource("file")
b64, err := ResToB64(input)
if err != nil {