mirror of
https://github.com/clearlinux/docker.git
synced 2026-10-03 23:38:24 +00:00
Port 'docker images' to the engine API
Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes)
This commit is contained in:
committed by
Victor Vieux
parent
6652416f4c
commit
17a806c8a0
@@ -0,0 +1,28 @@
|
||||
package engine
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
func TestTableWriteTo(t *testing.T) {
|
||||
table := NewTable("", 0)
|
||||
e := &Env{}
|
||||
e.Set("foo", "bar")
|
||||
table.Add(e)
|
||||
var buf bytes.Buffer
|
||||
if _, err := table.WriteTo(&buf); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
output := make(map[string]string)
|
||||
if err := json.Unmarshal(buf.Bytes(), &output); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(output) != 1 {
|
||||
t.Fatalf("Incorrect output: %v", output)
|
||||
}
|
||||
if val, exists := output["foo"]; !exists || val != "bar" {
|
||||
t.Fatalf("Inccorect output: %v", output)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user