switchToEmptyServer closes the current server and creates a new empty server, updating the config file to point to it.
(t *testing.T, env *testEnv)
| 133 | // switchToEmptyServer closes the current server and creates a new empty server, |
| 134 | // updating the config file to point to it. |
| 135 | func switchToEmptyServer(t *testing.T, env *testEnv) { |
| 136 | // Close old server |
| 137 | env.Server.Close() |
| 138 | |
| 139 | // Create new empty server |
| 140 | env.Server, env.ServerDB = setupNewServer(t) |
| 141 | |
| 142 | // Update config file to point to new server |
| 143 | apiEndpoint := fmt.Sprintf("%s/api", env.Server.URL) |
| 144 | updateConfigAPIEndpoint(t, env.TmpDir, apiEndpoint) |
| 145 | } |
| 146 | |
| 147 | // setupUser creates a test user in the server database |
| 148 | func setupUser(t *testing.T, env testEnv) database.User { |