Consolidate pytest.ini with pyproject.toml & add test
This commit is contained in:
@@ -1,10 +0,0 @@
|
||||
[pytest]
|
||||
log_cli = 1
|
||||
log_cli_level = INFO
|
||||
log_cli_format = %(asctime)s [%(levelname)8s] %(message)s (%(filename)s:%(lineno)s)
|
||||
log_cli_date_format=%Y-%m-%d %H:%M:%S
|
||||
pythonpath = ../app
|
||||
env =
|
||||
DATABASE_FILE=testdb.sqlite
|
||||
DATABASE_URL=sqlite:///testdb.sqlite?cache=shared
|
||||
|
||||
@@ -7,6 +7,7 @@ def test_initial_state(app):
|
||||
assert not app.error
|
||||
assert len(app.header) == 0 # No counter currently present
|
||||
|
||||
|
||||
def test_add_counter(app):
|
||||
app.run()
|
||||
|
||||
@@ -31,6 +32,7 @@ def test_add_counter(app):
|
||||
assert len(app.header) == 1 # A new counter was added
|
||||
assert app.header[0].value == ":material/calendar_clock: Walk"
|
||||
|
||||
|
||||
def test_remove_counter(app):
|
||||
|
||||
# Create a counter to remove
|
||||
@@ -57,3 +59,20 @@ def test_remove_counter(app):
|
||||
app.run()
|
||||
|
||||
assert len(app.header) == 0 # No counter exists
|
||||
|
||||
|
||||
def test_increment_counter(app):
|
||||
|
||||
# Create a counter to increment
|
||||
queries.crud.create_counter("Remove me", CounterType.SIMPLE, "020122")
|
||||
|
||||
app.run()
|
||||
assert not app.exception
|
||||
assert not app.error
|
||||
|
||||
assert len(app.header) == 1 # One counter exists
|
||||
assert "0 times" in app.markdown[0].value # Counter is 0
|
||||
|
||||
app.button(key="increment_counter_1").click().run()
|
||||
|
||||
assert "1 times" in app.markdown[0].value # Counter is 1
|
||||
|
||||
Reference in New Issue
Block a user