mirror of
https://github.com/mjl-/mox.git
synced 2025-07-13 06:54:38 +03:00
In tests, make initializing store/, its switchboard and an account more consistent.
Initialize store and switchboard first, then open account, and close in reverse order. Replace all "CheckClosed" calls with "WaitClosed", future changings will keep an account reference open for a bit after the last regular close, so we can't know that an account should be closed during tests. Remove one parameter from the (still too long) "start test server" function in imapserver testing code.
This commit is contained in:
@ -93,6 +93,7 @@ func tcompare(t *testing.T, got, expect any) {
|
||||
}
|
||||
|
||||
func TestAccount(t *testing.T) {
|
||||
log := mlog.New("webaccount", nil)
|
||||
os.RemoveAll("../testdata/httpaccount/data")
|
||||
mox.ConfigStaticPath = filepath.FromSlash("../testdata/httpaccount/mox.conf")
|
||||
mox.ConfigDynamicPath = filepath.Join(filepath.Dir(mox.ConfigStaticPath), "domains.conf")
|
||||
@ -103,7 +104,8 @@ func TestAccount(t *testing.T) {
|
||||
err := store.Close()
|
||||
tcheck(t, err, "store close")
|
||||
}()
|
||||
log := mlog.New("webaccount", nil)
|
||||
defer store.Switchboard()()
|
||||
|
||||
acc, err := store.OpenAccount(log, "mjl☺", false)
|
||||
tcheck(t, err, "open account")
|
||||
err = acc.SetPassword(log, "test1234")
|
||||
@ -113,7 +115,6 @@ func TestAccount(t *testing.T) {
|
||||
tcheck(t, err, "closing account")
|
||||
acc.WaitClosed()
|
||||
}()
|
||||
defer store.Switchboard()()
|
||||
|
||||
api := Account{cookiePath: "/account/"}
|
||||
apiHandler, err := makeSherpaHandler(api.cookiePath, false)
|
||||
|
Reference in New Issue
Block a user