I'm working on reservations puzzle, and wanted to create a reservation so I can see it in a list.
Clean db, code from master.
There are tests for such scenario in it_reservations_test.py.
First result when I tried to create a reservation (http://127.0.0.1:5000/reservations/create) is Bad CSRF token - what? Why? So it looks like the CreateView is not adding CSRF token, but our tests happily pass - this should not happen, tests should fail if there is no CSRF token.
Second error (when I disabled CSRF), I get sqlalchemy error:
sqlalchemy.exc.ProgrammingError: (psycopg2.ProgrammingError) column "num_of_persons" is of type timestamp without time zone but expression is of type integer LINE 1: ...imestamp, '2018-02-03T01:00:00'::timestamp, NULL, 3, 'Random... ^ HINT: You will need to rewrite or cast the expression. [SQL: 'INSERT INTO reservations (created_on, updated_on, start_time, end_time, customer_id, num_of_persons, comment, status) VALUES (%(created_on)s, %(updated_on)s, %(start_time)s, %(end_time)s, %(customer_id)s, %(num_of_persons)s, %(comment)s, %(status)s) RETURNING reservations.id'] [parameters: {'created_on': datetime.datetime(2019, 3, 15, 13, 39, 0, 71842), 'updated_on': datetime.datetime(2019, 3, 15, 13, 39, 0, 71847), 'start_time': datetime.datetime(2017, 8, 1, 1, 0), 'end_time': datetime.datetime(2018, 2, 3, 1, 0), 'customer_id': None, 'num_of_persons': 3, 'comment': 'Random comment', 'status': 'started'}] (Background on this error at: http://sqlalche.me/e/f405)
And the issue is in migrations, someone pushed a migration (2019-02-10T185948.py) that created such column:
Again, this should be captured by our tests, but didn't. This should be fixed, if we have tests that fail to discover such scenarios they are worthless.
I'm working on reservations puzzle, and wanted to create a reservation so I can see it in a list. Clean db, code from master.
There are tests for such scenario in it_reservations_test.py.
First result when I tried to create a reservation (http://127.0.0.1:5000/reservations/create) is Bad CSRF token - what? Why? So it looks like the CreateView is not adding CSRF token, but our tests happily pass - this should not happen, tests should fail if there is no CSRF token.
Second error (when I disabled CSRF), I get sqlalchemy error:
And the issue is in migrations, someone pushed a migration (
2019-02-10T185948.py
) that created such column:Again, this should be captured by our tests, but didn't. This should be fixed, if we have tests that fail to discover such scenarios they are worthless.