Commit Graph
8 Commits
Author SHA1 Message Date
Andre Neto db490b0354 Fix the defects the suite pinned; turn xfail/known_bug into regressions
The suite documented every defect with two `xfail` and four `test_known_bug_*`
tests. With the tests as the specification, all of them are fixed and those
tests are now regression tests that fail against the previous code:

- findby_director() returned None on the success path (it printed the matches
  and fell off the end); it returns the rows now.
- findby_actor() raised UnboundLocalError when no actor matched, and returned
  only the last article of an actor with several; it returns the list, or None.
- findby_name() and findby_type() returned the integer 0 on no match, which
  main.py indexed into; they return an empty list and the menus skip it.
- purchase() debited USERID (the account of the last log_in) instead of the
  userid argument, while the rent went to the argument.
- the message list looked the author up with row[4] (the recipient) instead of
  row[5] (the sender), in the unread and in the read list.
- remove_article() checked only the open rents, so the foreign keys on the
  older rents and on pricehistory turned the refusal into a traceback; it now
  explains which records keep the article and rolls back as a backstop.
- show_unread_messages() returned None when there was nothing; it returns an
  empty list like the read side, and the messages menu skips an empty list.
- database.USERID did not exist before a login, so leaving the menu with 0
  raised AttributeError; it starts as None and the menu code handles 0.
- every connection is opened and closed by one context manager:
  findby_director(), findby_actor() and findby_type() returned before
  conn.close() and statistics() never closed, leaving sessions
  `idle in transaction`.

make test: 40 passed, 0 xfailed (was 30 passed, 2 xfailed). No xfail and no
test_known_bug_* is left. The README's previous "what is broken" paragraph and
its test output are updated, and a "Known limitations" section lists what was
deliberately not touched: SQL built by string concatenation, menu selections
past the end of the list, and input() inside the data layer.
2026-10-08 14:38:11 +01:00
agsNeto20 22dd6968d9 Add files via upload 2020-12-12 13:40:18 +00:00
agsNeto20 32877ad278 Delete database.py 2020-12-12 13:36:46 +00:00
agsNeto20 dced1e0d7e Add files via upload 2020-12-12 06:31:39 +00:00
agsNeto20 b76cce566c Delete database.py 2020-12-12 06:25:04 +00:00
agsNeto20 2e7a798c59 Add files via upload 2020-12-10 20:01:58 +00:00
agsNeto20 9b11d10792 Delete database.py 2020-12-10 20:00:49 +00:00
agsNeto20 d0d8203a61 Add files via upload 2020-11-26 12:50:21 +00:00