func TestValidUserRegistration(t *testing.T) {
	saveLists()
	u, err := registerNewUser("newuser", "newpass")
	if err != nil || u.Username == "" {
		t.Fail()
	}
	restoreLists()
}
Test if a new user can be registered with valid username/password
package main
import "testing"
func TestUserValidity(t *testing.T) {
	if !isUserValid("user1", "pass1") {
		t.Fail()
	}
	if isUserValid("user2", "pass1") {
		t.Fail()
	}
	if isUserValid("user1", "") {
		t.Fail()
	}
	if isUserValid("", "pass1") {
		t.Fail()
	}
	if isUserValid("User1", "pass1") {
		t.Fail()
	}
}