1
0
mirror of https://github.com/aclindsa/moneygo.git synced 2025-07-02 04:18:38 -04:00

Create framework to automate creation/teardown of test data

This commit is contained in:
2017-10-08 20:29:51 -04:00
parent 3c6b5528f9
commit bd52df65cd
4 changed files with 142 additions and 108 deletions

View File

@ -35,6 +35,16 @@ func PutForm(client *http.Client, url string, data url.Values) (*http.Response,
return client.Do(request)
}
func RunWith(t *testing.T, d *TestData, fn TestDataFunc) {
testdata, err := d.Initialize()
if err != nil {
t.Fatal("Failed to initialize test data: %s", err)
}
defer testdata.Teardown()
fn(t, testdata)
}
func RunTests(m *testing.M) int {
tmpdir, err := ioutil.TempDir("./", "handlertest")
if err != nil {