2fbcf6ee6d
A few things at once because it was faster to get a demo out the door. Skipping most test implementation though I made failing stubs so I know what to fill in later. * Get/Post WalletState * downloadKey/email so that a second client can log in, and/or recover from lost client * Test client in Python to demonstrate the above * Organize into packages
32 lines
481 B
Go
32 lines
481 B
Go
package store
|
|
|
|
import (
|
|
"io/ioutil"
|
|
"os"
|
|
"testing"
|
|
)
|
|
|
|
func StoreTestInit(t *testing.T) (s Store, tmpFile *os.File) {
|
|
s = Store{}
|
|
|
|
tmpFile, err := ioutil.TempFile(os.TempDir(), "sqlite-test-")
|
|
if err != nil {
|
|
t.Fatalf("DB setup failure: %+v", err)
|
|
return
|
|
}
|
|
|
|
s.Init(tmpFile.Name())
|
|
|
|
err = s.Migrate()
|
|
if err != nil {
|
|
t.Fatalf("DB setup failure: %+v", err)
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
func StoreTestCleanup(tmpFile *os.File) {
|
|
if tmpFile != nil {
|
|
os.Remove(tmpFile.Name())
|
|
}
|
|
}
|