Modify gitlab test server to be more generic
This MR improves the gitlab test server used in tests involving hooks. The reason for this change is so that we can use these helpers in a more generic way.
The main changes are:
- do not use
*testing.T
in the functions. This way, we can also use these helpers in main functions withtesting.M
. - No longer use
*testing.T
in the servers, and instead check the expected value and return an HTTP error code, simulating what the actual gitlab server does. - If the expected value that is passed in is empty, then just check that the form value is non-empty
- If the expected value that is passed in is not empty, then check that it matches the value in the form param
!1843 (merged) will use this to exercise tests in the operations service. In its current form, it couldn't be used in a TestMain
function because it didn't have a *testing.T
struct to pass in.
Edited by John Cai