aboutsummaryrefslogtreecommitdiff
path: root/server/szurubooru/tests/api/test_snapshot_retrieving.py
diff options
context:
space:
mode:
authorrr-2017-02-04 01:08:12 +0100
committerrr-2017-02-05 16:34:45 +0100
commitad842ee8a54c57463b8e28b52970f173ea1d64ea (patch)
tree1238e8270878801a2ddb10bc4db469115c026cab /server/szurubooru/tests/api/test_snapshot_retrieving.py
parentabf1fc2b2d135299fe7e8a700d4e7a18966d7bfe (diff)
server: refactor + add type hinting
- Added type hinting (for now, 3.5-compatible) - Split `db` namespace into `db` module and `model` namespace - Changed elastic search to be created lazily for each operation - Changed to class based approach in entity serialization to allow stronger typing - Removed `required` argument from `context.get_*` family of functions; now it's implied if `default` argument is omitted - Changed `unalias_dict` implementation to use less magic inputs
Diffstat (limited to 'server/szurubooru/tests/api/test_snapshot_retrieving.py')
-rw-r--r--server/szurubooru/tests/api/test_snapshot_retrieving.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/server/szurubooru/tests/api/test_snapshot_retrieving.py b/server/szurubooru/tests/api/test_snapshot_retrieving.py
index 73b6f06..facbcd8 100644
--- a/server/szurubooru/tests/api/test_snapshot_retrieving.py
+++ b/server/szurubooru/tests/api/test_snapshot_retrieving.py
@@ -1,10 +1,10 @@
from datetime import datetime
import pytest
-from szurubooru import api, db, errors
+from szurubooru import api, db, model, errors
def snapshot_factory():
- snapshot = db.Snapshot()
+ snapshot = model.Snapshot()
snapshot.creation_time = datetime(1999, 1, 1)
snapshot.resource_type = 'dummy'
snapshot.resource_pkey = 1
@@ -17,7 +17,7 @@ def snapshot_factory():
@pytest.fixture(autouse=True)
def inject_config(config_injector):
config_injector({
- 'privileges': {'snapshots:list': db.User.RANK_REGULAR},
+ 'privileges': {'snapshots:list': model.User.RANK_REGULAR},
})
@@ -29,7 +29,7 @@ def test_retrieving_multiple(user_factory, context_factory):
result = api.snapshot_api.get_snapshots(
context_factory(
params={'query': '', 'page': 1},
- user=user_factory(rank=db.User.RANK_REGULAR)))
+ user=user_factory(rank=model.User.RANK_REGULAR)))
assert result['query'] == ''
assert result['page'] == 1
assert result['pageSize'] == 100
@@ -43,4 +43,4 @@ def test_trying_to_retrieve_multiple_without_privileges(
api.snapshot_api.get_snapshots(
context_factory(
params={'query': '', 'page': 1},
- user=user_factory(rank=db.User.RANK_ANONYMOUS)))
+ user=user_factory(rank=model.User.RANK_ANONYMOUS)))

© 2015 - 2026 Jakob L. Kreuze