github.com/flavio/docker@v0.1.3-0.20170117145210-f63d1a6eec47/cli/compose/schema/schema_test.go (about)

     1  package schema
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/assert"
     7  )
     8  
     9  type dict map[string]interface{}
    10  
    11  func TestValid(t *testing.T) {
    12  	config := dict{
    13  		"version": "2.1",
    14  		"services": dict{
    15  			"foo": dict{
    16  				"image": "busybox",
    17  			},
    18  		},
    19  	}
    20  
    21  	assert.NoError(t, Validate(config))
    22  }
    23  
    24  func TestUndefinedTopLevelOption(t *testing.T) {
    25  	config := dict{
    26  		"version": "2.1",
    27  		"helicopters": dict{
    28  			"foo": dict{
    29  				"image": "busybox",
    30  			},
    31  		},
    32  	}
    33  
    34  	assert.Error(t, Validate(config))
    35  }