test(api/v2): use cross-engine datetime literals in testing webtest
MariaDB strict mode rejects the RFC3339 T/Z form for DATETIME columns. The space-separated form is accepted by MariaDB, Postgres and SQLite alike; the test only asserts on title and row counts, never the datetime.
This commit is contained in:
parent
7c2b139825
commit
83f3b51d67
|
|
@ -104,7 +104,7 @@ func TestTesting(t *testing.T) {
|
||||||
e := setupTestingEnv(t, testingToken)
|
e := setupTestingEnv(t, testingToken)
|
||||||
t.Cleanup(func() { _ = db.LoadFixtures() })
|
t.Cleanup(func() { _ = db.LoadFixtures() })
|
||||||
|
|
||||||
body := `[{"id":1,"title":"only label","created_by_id":1,"created":"2020-01-01T00:00:00Z","updated":"2020-01-01T00:00:00Z"}]`
|
body := `[{"id":1,"title":"only label","created_by_id":1,"created":"2020-01-01 00:00:00","updated":"2020-01-01 00:00:00"}]`
|
||||||
rec := testingRequest(e, http.MethodPut, "/api/v2/test/labels", body, testingToken)
|
rec := testingRequest(e, http.MethodPut, "/api/v2/test/labels", body, testingToken)
|
||||||
require.Equal(t, http.StatusCreated, rec.Code, "body: %s", rec.Body.String())
|
require.Equal(t, http.StatusCreated, rec.Code, "body: %s", rec.Body.String())
|
||||||
|
|
||||||
|
|
@ -122,7 +122,7 @@ func TestTesting(t *testing.T) {
|
||||||
before := countRows(t, "labels")
|
before := countRows(t, "labels")
|
||||||
require.Positive(t, before, "fixtures should seed some labels")
|
require.Positive(t, before, "fixtures should seed some labels")
|
||||||
|
|
||||||
body := `[{"id":9999,"title":"added label","created_by_id":1,"created":"2020-01-01T00:00:00Z","updated":"2020-01-01T00:00:00Z"}]`
|
body := `[{"id":9999,"title":"added label","created_by_id":1,"created":"2020-01-01 00:00:00","updated":"2020-01-01 00:00:00"}]`
|
||||||
rec := testingRequest(e, http.MethodPut, "/api/v2/test/labels?truncate=false", body, testingToken)
|
rec := testingRequest(e, http.MethodPut, "/api/v2/test/labels?truncate=false", body, testingToken)
|
||||||
require.Equal(t, http.StatusCreated, rec.Code, "body: %s", rec.Body.String())
|
require.Equal(t, http.StatusCreated, rec.Code, "body: %s", rec.Body.String())
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue