|
9 | 9 | from tests.dbasserts import assert_sql_result
|
10 | 10 |
|
11 | 11 |
|
12 |
| -@pytest.fixture(name="hola_tag") |
13 |
| -def fixture_hola_tag(spanish, app_context): |
| 12 | +@pytest.fixture(name="_hola_tag") |
| 13 | +def fixture_hola_tag(app_context): |
| 14 | + "A dummy tag for tests." |
14 | 15 | t = TermTag("Hola", "Hola comment")
|
15 | 16 | db.session.add(t)
|
16 | 17 | db.session.commit()
|
17 | 18 |
|
18 | 19 |
|
19 |
| -def test_save(hola_tag, app_context): |
| 20 | +def test_save(_hola_tag, app_context): |
| 21 | + "Save saves!" |
20 | 22 | sql = "select TgID, TgText, TgComment from tags"
|
21 | 23 | expected = ["1; Hola; Hola comment"]
|
22 | 24 | assert_sql_result(sql, expected)
|
23 | 25 |
|
24 | 26 |
|
25 |
| -def test_new_dup_tag_text_fails(hola_tag, spanish, app_context): |
| 27 | +def test_new_dup_tag_text_fails(_hola_tag, app_context): |
| 28 | + "Smoke test of db integrity." |
26 | 29 | t2 = TermTag("Hola", "dup")
|
27 | 30 | db.session.add(t2)
|
28 | 31 | with pytest.raises(Exception):
|
29 | 32 | db.session.commit()
|
30 | 33 |
|
31 | 34 |
|
32 |
| -def test_find_by_text(hola_tag, app_context): |
| 35 | +def test_find_by_text(_hola_tag, app_context): |
| 36 | + "Find by text returns match." |
33 | 37 | retrieved = TermTag.find_by_text("Hola")
|
34 | 38 | assert retrieved is not None
|
35 | 39 | assert retrieved.text == "Hola"
|
36 | 40 |
|
37 | 41 |
|
38 |
| -def test_find_by_text_returns_null_if_not_exact_match(hola_tag, app_context): |
| 42 | +def test_find_by_text_returns_null_if_not_exact_match(_hola_tag, app_context): |
| 43 | + "Find returns null if no match." |
| 44 | + # TODO check if used: this method feels useless. |
39 | 45 | assert TermTag.find_by_text("unknown") is None
|
40 | 46 | assert TermTag.find_by_text("hola") is None
|
41 | 47 |
|
42 | 48 |
|
43 |
| -def test_find_or_create_by_text_returns_new_if_no_match(hola_tag, app_context): |
| 49 | +def test_find_or_create_by_text_returns_new_if_no_match(_hola_tag, app_context): |
| 50 | + "Return new." |
44 | 51 | assert TermTag.find_by_text("unknown") is None
|
45 | 52 | t = TermTag.find_or_create_by_text("unknown")
|
46 | 53 | assert t.text == 'unknown', 'new tag created'
|
0 commit comments