summaryrefslogtreecommitdiff
path: root/cmd/podman/formats/formats_test.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-03-11 17:56:58 -0700
committerGitHub <noreply@github.com>2019-03-11 17:56:58 -0700
commitdcd253f2e4da25e7e5af33bef4de5529162a7c1b (patch)
tree93d6028a81bf6a3979134ac66384e615ddf0cc4d /cmd/podman/formats/formats_test.go
parentdec36f2d0b940f7c144dd5617b3cb5bd31fd2bc5 (diff)
parente3d8e79d9569f3e328facac7978ed3c2ad786eb7 (diff)
downloadpodman-dcd253f2e4da25e7e5af33bef4de5529162a7c1b.tar.gz
podman-dcd253f2e4da25e7e5af33bef4de5529162a7c1b.tar.bz2
podman-dcd253f2e4da25e7e5af33bef4de5529162a7c1b.zip
Merge pull request #2609 from QiWang19/moveformats
move formats pkg to and vendor from buildah
Diffstat (limited to 'cmd/podman/formats/formats_test.go')
-rw-r--r--cmd/podman/formats/formats_test.go42
1 files changed, 0 insertions, 42 deletions
diff --git a/cmd/podman/formats/formats_test.go b/cmd/podman/formats/formats_test.go
deleted file mode 100644
index c75109d65..000000000
--- a/cmd/podman/formats/formats_test.go
+++ /dev/null
@@ -1,42 +0,0 @@
-package formats
-
-import (
- "bytes"
- "strings"
- "testing"
-
- "github.com/containers/libpod/pkg/inspect"
-)
-
-func TestSetJSONFormatEncoder(t *testing.T) {
- tt := []struct {
- name string
- imageData *inspect.ImageData
- expected string
- isTerminal bool
- }{
- {
- name: "HTML tags are not escaped",
- imageData: &inspect.ImageData{Author: "dave <dave@corp.io>"},
- expected: `"Author": "dave <dave@corp.io>"`,
- isTerminal: true,
- },
- {
- name: "HTML tags are escaped",
- imageData: &inspect.ImageData{Author: "dave <dave@corp.io>"},
- expected: `"Author": "dave \u003cdave@corp.io\u003e"`,
- isTerminal: false,
- },
- }
-
- for _, tc := range tt {
- buf := bytes.NewBuffer(nil)
- enc := setJSONFormatEncoder(tc.isTerminal, buf)
- if err := enc.Encode(tc.imageData); err != nil {
- t.Errorf("test %#v failed encoding: %s", tc.name, err)
- }
- if !strings.Contains(buf.String(), tc.expected) {
- t.Errorf("test %#v expected output to contain %#v. Output:\n%v\n", tc.name, tc.expected, buf.String())
- }
- }
-}