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:
@ -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 {
|
||||
|
Reference in New Issue
Block a user