grim/convey

337bbe34fcfc
Parents fbf02cafd889
Children d212b78ddd43
Add the login and logout tests I forgot to add earlier
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/docker/login_test.go Mon Oct 11 05:07:03 2021 -0500
@@ -0,0 +1,54 @@
+package docker
+
+import (
+ "testing"
+
+ . "github.com/onsi/gomega"
+
+ "keep.imfreedom.org/grim/convey/podman"
+)
+
+func TestLogin(t *testing.T) {
+ g := NewGomegaWithT(t)
+
+ l := &Login{
+ Server: "docker.io",
+ Username: "username",
+ Password: "password",
+ }
+
+ g.Expect(l.Valid()).To(BeNil())
+}
+
+func TestLoginServerRequired(t *testing.T) {
+ g := NewGomegaWithT(t)
+
+ l := &Login{
+ Username: "username",
+ Password: "password",
+ }
+
+ g.Expect(l.Valid()).To(MatchError(podman.ErrNoRegistry))
+}
+
+func TestLoginUsernameRequired(t *testing.T) {
+ g := NewGomegaWithT(t)
+
+ l := &Login{
+ Server: "docker.io",
+ Password: "password",
+ }
+
+ g.Expect(l.Valid()).To(MatchError(podman.ErrNoUsername))
+}
+
+func TestLoginPasswordRequired(t *testing.T) {
+ g := NewGomegaWithT(t)
+
+ l := &Login{
+ Server: "docker.io",
+ Username: "username",
+ }
+
+ g.Expect(l.Valid()).To(MatchError(podman.ErrNoPassword))
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/docker/logout_test.go Mon Oct 11 05:07:03 2021 -0500
@@ -0,0 +1,27 @@
+package docker
+
+import (
+ "testing"
+
+ . "github.com/onsi/gomega"
+
+ "keep.imfreedom.org/grim/convey/podman"
+)
+
+func TestLogout(t *testing.T) {
+ g := NewGomegaWithT(t)
+
+ l := &Logout{
+ Server: "docker.io",
+ }
+
+ g.Expect(l.Valid()).To(BeNil())
+}
+
+func TestLoginRegistryRequired(t *testing.T) {
+ g := NewGomegaWithT(t)
+
+ l := &Logout{}
+
+ g.Expect(l.Valid()).To(MatchError(podman.ErrNoRegistry))
+}