FIX #2171 Fix faulty flag and add tests for SetConfigFromFlags

Signed-off-by: David Gageot <david@gageot.net>
This commit is contained in:
David Gageot 2015-11-05 12:57:43 +01:00
parent 15d213dcd7
commit f47ab21dd0
1 changed files with 29 additions and 0 deletions

View File

@ -0,0 +1,29 @@
package openstack
import (
"testing"
"github.com/docker/machine/libmachine/drivers"
"github.com/stretchr/testify/assert"
)
func TestSetConfigFromFlags(t *testing.T) {
driver := NewDriver("default", "path")
checkFlags := &drivers.CheckDriverOptions{
FlagsValues: map[string]interface{}{
"openstack-auth-url": "http://url",
"openstack-username": "user",
"openstack-password": "pwd",
"openstack-tenant-id": "ID",
"openstack-flavor-id": "ID",
"openstack-image-id": "ID",
},
CreateFlags: driver.GetCreateFlags(),
}
err := driver.SetConfigFromFlags(checkFlags)
assert.NoError(t, err)
assert.Empty(t, checkFlags.InvalidFlags)
}