forked from coop-cloud/abra
test: increatse client/context.go coverage to 90%
This commit is contained in:
parent
0615c3f745
commit
78460ac0ba
|
@ -3,3 +3,4 @@ abra
|
|||
vendor/
|
||||
.envrc
|
||||
dist/
|
||||
*fmtcoverage.html
|
||||
|
|
|
@ -30,6 +30,33 @@ func dockerContext(host, key string) TestContext {
|
|||
}
|
||||
}
|
||||
|
||||
func TestCreateContext(t *testing.T) {
|
||||
err := client.CreateContext("testCreate", "wronguser", "wrongport")
|
||||
if err == nil {
|
||||
t.Error("client.CreateContext(\"testCreate\", \"wronguser\", \"wrongport\") should have failed but didn't return an error")
|
||||
}
|
||||
err = client.CreateContext("testCreate", "", "")
|
||||
if err != nil {
|
||||
t.Errorf("Couldn't create context: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDeleteContext(t *testing.T) {
|
||||
err := client.DeleteContext("default")
|
||||
if err == nil {
|
||||
t.Errorf("client.DeleteContext(\"default\") should have failed but didn't return an error")
|
||||
}
|
||||
|
||||
err = client.DeleteContext("testCreate")
|
||||
if err != nil {
|
||||
t.Errorf("client.DeleteContext(\"testCreate\") failed: %s", err)
|
||||
}
|
||||
err = client.DeleteContext("testCreate")
|
||||
if err == nil {
|
||||
t.Errorf("client.DeleteContext(\"testCreate\") should have failed this time (attempt to delete non-existent context) but didn't return an error")
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetContextEndpoint(t *testing.T) {
|
||||
var testDockerContexts = []TestContext{
|
||||
dockerContext("ssh://foobar", "docker"),
|
||||
|
|
Loading…
Reference in New Issue