| th "github.com/rackspace/gophercloud/testhelper" |
| func TestMaybeStringWithNonEmptyString(t *testing.T) { |
| actual := MaybeString("carol") |
| th.CheckDeepEquals(t, actual, expected) |
| func TestMaybeStringWithEmptyString(t *testing.T) { |
| actual := MaybeString("") |
| th.CheckDeepEquals(t, actual, expected) |
| func TestBuildQueryStringWithPointerToStruct(t *testing.T) { |
| opts := Opts{J: 2, R: "red"} |
| actual, err := BuildQueryString(&opts) |
| t.Errorf("Error building query string: %v", err) |
| th.CheckDeepEquals(t, actual, expected) |
| func TestBuildQueryStringWithoutRequiredFieldSet(t *testing.T) { |
| R string `q:"r,required"` |
| opts := Opts{J: 2, C: true} |
| _, err := BuildQueryString(&opts) |
| t.Error("Unexpected result: There should be an error thrown when a required field isn't set.") |