comparison auth/auth_test.go @ 16:bfc035bd5132

cleaning up tests per go vet
author Paul Fisher <paul@pfish.zone>
date Fri, 30 Oct 2015 00:01:59 -0400
parents 4368a377ff64
children
comparison
equal deleted inserted replaced
15:9b4ec6b5c23e 16:bfc035bd5132
110 } 110 }
111 if !passPattern.MatchString(password) { 111 if !passPattern.MatchString(password) {
112 t.Errorf("NewEntry(_) = _, %q, _; wanted to match xxxx-xxxx-xxxx-xxxx", password) 112 t.Errorf("NewEntry(_) = _, %q, _; wanted to match xxxx-xxxx-xxxx-xxxx", password)
113 } 113 }
114 if !entry.Authenticate(password) { 114 if !entry.Authenticate(password) {
115 t.Errorf("NewEntry(%q).Authenticate(%q, %q) failed", 115 t.Errorf("NewEntry(%q).Authenticate(%q) failed",
116 c.description, password) 116 c.description, password)
117 } 117 }
118 } 118 }
119 } 119 }
120 120
140 {"not the password", false}, 140 {"not the password", false},
141 } 141 }
142 for _, c := range cases { 142 for _, c := range cases {
143 got := entry.Authenticate(c.password) 143 got := entry.Authenticate(c.password)
144 if got != c.want { 144 if got != c.want {
145 t.Errorf("entry.Authenticate(%q) == %q, want %q", 145 t.Errorf("entry.Authenticate(%q) == %v, want %v",
146 c.password, got, c.want) 146 c.password, got, c.want)
147 } 147 }
148 } 148 }
149 149
150 entry, err = EntryFromShadow(basicShadow) 150 entry, err = EntryFromShadow(basicShadow)
157 {"not the password", false}, 157 {"not the password", false},
158 } 158 }
159 for _, c := range cases { 159 for _, c := range cases {
160 got := entry.Authenticate(c.password) 160 got := entry.Authenticate(c.password)
161 if got != c.want { 161 if got != c.want {
162 t.Errorf("entry.Authenticate(%q, %q) == %q, want %q", 162 t.Errorf("entry.Authenticate(%q) == %v, want %v",
163 c.password, got, c.want) 163 c.password, got, c.want)
164 } 164 }
165 } 165 }
166 } 166 }
167 167