other mfa store tests

save a few bytes
This commit is contained in:
Azareal 2020-04-03 08:24:32 +10:00
parent 95d3f9ebe1
commit 8b059ac877
11 changed files with 36 additions and 29 deletions

View File

@ -14,16 +14,16 @@ type searchAndFilter struct {
func widgetSearchAndFilter(widget *Widget, hvars interface{}) (out string, err error) {
header := hvars.(*Header)
user := header.CurrentUser
u := header.CurrentUser
var forums []filterForum
var canSee []int
if user.IsSuperAdmin {
if u.IsSuperAdmin {
canSee, err = Forums.GetAllVisibleIDs()
if err != nil {
return "", err
}
} else {
group, err := Groups.Get(user.Group)
group, err := Groups.Get(u.Group)
if err != nil {
// TODO: Revisit this
return "", errors.New("Something weird happened")

View File

@ -1841,6 +1841,13 @@ func TestMFAStore(t *testing.T) {
it, err = c.MFAstore.Get(1)
test(i)
}
expectNilErr(t, it.Delete())
_, err = c.MFAstore.Get(-1)
recordMustNotExist(t, err, "mfa uid -1 should not exist")
_, err = c.MFAstore.Get(0)
recordMustNotExist(t, err, "mfa uid 0 should not exist")
_, err = c.MFAstore.Get(1)
recordMustNotExist(t, err, "mfa uid 1 should not exist")
}
// TODO: Expand upon the valid characters which can go in URLs?