Mercurial > go > multipass
comparison auth/auth_test.go @ 14:4368a377ff64
gofmt.
| author | Paul Fisher <paul@pfish.zone> |
|---|---|
| date | Thu, 29 Oct 2015 21:31:28 -0400 |
| parents | 1c194fa9bbf4 |
| children | bfc035bd5132 |
comparison
equal
deleted
inserted
replaced
| 13:da6c493cf08a | 14:4368a377ff64 |
|---|---|
| 19 hash string | 19 hash string |
| 20 description string | 20 description string |
| 21 rest []string | 21 rest []string |
| 22 }{ | 22 }{ |
| 23 { | 23 { |
| 24 shadow: "1234:$2a$12$apFtWGXKtWBavVy5eo.22Ohs43GudT5IYTqyQkIBX9LpS7YtvKBpa:", | 24 shadow: "1234:$2a$12$apFtWGXKtWBavVy5eo.22Ohs43GudT5IYTqyQkIBX9LpS7YtvKBpa:", |
| 25 id: 1234, | 25 id: 1234, |
| 26 hash: "$2a$12$apFtWGXKtWBavVy5eo.22Ohs43GudT5IYTqyQkIBX9LpS7YtvKBpa", | 26 hash: "$2a$12$apFtWGXKtWBavVy5eo.22Ohs43GudT5IYTqyQkIBX9LpS7YtvKBpa", |
| 27 }, | 27 }, |
| 28 { | 28 { |
| 29 shadow: basicShadow, | 29 shadow: basicShadow, |
| 30 id: 9999, | 30 id: 9999, |
| 31 hash: "$2a$12$tcv2MrtXgibAJHsSwVfHiOevXBFmiGy0HTNoOB8QzIhEh46iWS1uC", | 31 hash: "$2a$12$tcv2MrtXgibAJHsSwVfHiOevXBFmiGy0HTNoOB8QzIhEh46iWS1uC", |
| 32 description: "anything more than 5 reps is cardio", | 32 description: "anything more than 5 reps is cardio", |
| 33 }, | 33 }, |
| 34 { | 34 { |
| 35 shadow: anotherShadow, | 35 shadow: anotherShadow, |
| 36 id: 1, | 36 id: 1, |
| 37 hash: "$2a$12$lINQdYWHOcLKoqhNOr3mNOpZSAu5JOBS2F7T/VDfYn2rvv6qUJehG", | 37 hash: "$2a$12$lINQdYWHOcLKoqhNOr3mNOpZSAu5JOBS2F7T/VDfYn2rvv6qUJehG", |
| 38 }, | 38 }, |
| 39 { | 39 { |
| 40 shadow: "one:bogushash:", | 40 shadow: "one:bogushash:", |
| 41 wantErr: true, | 41 wantErr: true, |
| 42 }, | 42 }, |
| 51 { | 51 { |
| 52 shadow: "0:bogushash:invalid base64", | 52 shadow: "0:bogushash:invalid base64", |
| 53 wantErr: true, | 53 wantErr: true, |
| 54 }, | 54 }, |
| 55 { | 55 { |
| 56 shadow: "1:bogushash::more things", | 56 shadow: "1:bogushash::more things", |
| 57 wantErr: true, | 57 wantErr: true, |
| 58 }, | 58 }, |
| 59 } | 59 } |
| 60 for _, c := range cases { | 60 for _, c := range cases { |
| 61 entry, err := EntryFromShadow(c.shadow) | 61 entry, err := EntryFromShadow(c.shadow) |
| 130 if err != nil { | 130 if err != nil { |
| 131 t.Errorf("Error building entry") | 131 t.Errorf("Error building entry") |
| 132 } | 132 } |
| 133 type testcase struct { | 133 type testcase struct { |
| 134 password string | 134 password string |
| 135 want bool | 135 want bool |
| 136 } | 136 } |
| 137 | 137 |
| 138 cases := []testcase{ | 138 cases := []testcase{ |
| 139 {password, true}, | 139 {password, true}, |
| 140 {"not the password", false}, | 140 {"not the password", false}, |
