Resolved code formatting change requests
This commit is contained in:
parent
addd2afdaa
commit
4dcbfbdc33
6 changed files with 26 additions and 23 deletions
|
@ -21,7 +21,7 @@ test_database: 'sqlite:///:memory:' # required for running the test suite
|
||||||
|
|
||||||
|
|
||||||
# Delete thumbnails and source files on post delete
|
# Delete thumbnails and source files on post delete
|
||||||
# Original functionality is false, to mitigate the impacts of admins going
|
# Original functionality is no, to mitigate the impacts of admins going
|
||||||
# on unchecked post purges.
|
# on unchecked post purges.
|
||||||
delete_source_files: no
|
delete_source_files: no
|
||||||
|
|
||||||
|
|
|
@ -399,7 +399,7 @@ def _after_post_update(
|
||||||
def _before_post_delete(
|
def _before_post_delete(
|
||||||
_mapper: Any, _connection: Any, post: model.Post) -> None:
|
_mapper: Any, _connection: Any, post: model.Post) -> None:
|
||||||
if post.post_id:
|
if post.post_id:
|
||||||
image_hash.delete_image(str(post.post_id))
|
image_hash.delete_image(post.post_id)
|
||||||
if config.config['delete_source_files']:
|
if config.config['delete_source_files']:
|
||||||
files.delete(get_post_content_path(post))
|
files.delete(get_post_content_path(post))
|
||||||
files.delete(get_post_thumbnail_path(post))
|
files.delete(get_post_thumbnail_path(post))
|
||||||
|
|
|
@ -8,10 +8,14 @@ from szurubooru.func import posts, snapshots
|
||||||
|
|
||||||
@pytest.fixture(autouse=True)
|
@pytest.fixture(autouse=True)
|
||||||
def inject_config(config_injector):
|
def inject_config(config_injector):
|
||||||
config_injector({'secret': 'secret',
|
config_injector({
|
||||||
'data_dir': '',
|
'secret': 'secret',
|
||||||
'delete_source_files': False,
|
'data_dir': '',
|
||||||
'privileges': {'posts:delete': model.User.RANK_REGULAR}})
|
'delete_source_files': False,
|
||||||
|
'privileges': {
|
||||||
|
'posts:delete': model.User.RANK_REGULAR
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
def test_deleting(user_factory, post_factory, context_factory):
|
def test_deleting(user_factory, post_factory, context_factory):
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from szurubooru import db, model
|
from szurubooru import db, model
|
||||||
from szurubooru.func import (
|
from szurubooru.func import (
|
||||||
posts, users, comments, tags, images, files, util, image_hash)
|
posts, users, comments, tags, images, files, util, image_hash)
|
||||||
|
@ -843,8 +841,8 @@ def test_merge_posts_moves_child_relations(post_factory, config_injector):
|
||||||
assert posts.get_post_by_id(target_post.post_id).relation_count == 1
|
assert posts.get_post_by_id(target_post.post_id).relation_count == 1
|
||||||
|
|
||||||
|
|
||||||
def test_merge_posts_doesnt_duplicate_child_relations(post_factory,
|
def test_merge_posts_doesnt_duplicate_child_relations(
|
||||||
config_injector):
|
post_factory, config_injector):
|
||||||
config_injector({'delete_source_files': False})
|
config_injector({'delete_source_files': False})
|
||||||
source_post = post_factory()
|
source_post = post_factory()
|
||||||
target_post = post_factory()
|
target_post = post_factory()
|
||||||
|
@ -879,8 +877,8 @@ def test_merge_posts_moves_parent_relations(post_factory, config_injector):
|
||||||
assert posts.get_post_by_id(related_post.post_id).relation_count == 1
|
assert posts.get_post_by_id(related_post.post_id).relation_count == 1
|
||||||
|
|
||||||
|
|
||||||
def test_merge_posts_doesnt_duplicate_parent_relations(post_factory,
|
def test_merge_posts_doesnt_duplicate_parent_relations(
|
||||||
config_injector):
|
post_factory, config_injector):
|
||||||
config_injector({'delete_source_files': False})
|
config_injector({'delete_source_files': False})
|
||||||
source_post = post_factory()
|
source_post = post_factory()
|
||||||
target_post = post_factory()
|
target_post = post_factory()
|
||||||
|
@ -898,8 +896,8 @@ def test_merge_posts_doesnt_duplicate_parent_relations(post_factory,
|
||||||
assert posts.get_post_by_id(related_post.post_id).relation_count == 1
|
assert posts.get_post_by_id(related_post.post_id).relation_count == 1
|
||||||
|
|
||||||
|
|
||||||
def test_merge_posts_doesnt_create_relation_loop_for_children(post_factory,
|
def test_merge_posts_doesnt_create_relation_loop_for_children(
|
||||||
config_injector):
|
post_factory, config_injector):
|
||||||
config_injector({'delete_source_files': False})
|
config_injector({'delete_source_files': False})
|
||||||
source_post = post_factory()
|
source_post = post_factory()
|
||||||
target_post = post_factory()
|
target_post = post_factory()
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from szurubooru import db, model
|
from szurubooru import db, model
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(autouse=True)
|
@pytest.fixture(autouse=True)
|
||||||
def inject_config(config_injector):
|
def inject_config(config_injector):
|
||||||
config_injector({'secret': 'secret',
|
config_injector({
|
||||||
'data_dir': '',
|
'secret': 'secret',
|
||||||
'delete_source_files': False})
|
'data_dir': '',
|
||||||
|
'delete_source_files': False
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
def test_saving_post(post_factory, user_factory, tag_factory):
|
def test_saving_post(post_factory, user_factory, tag_factory):
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from szurubooru import db, model
|
from szurubooru import db, model
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(autouse=True)
|
@pytest.fixture(autouse=True)
|
||||||
def inject_config(config_injector):
|
def inject_config(config_injector):
|
||||||
config_injector({'delete_source_files': False,
|
config_injector({
|
||||||
'secret': 'secret', 'data_dir': ''})
|
'delete_source_files': False,
|
||||||
|
'secret': 'secret',
|
||||||
|
'data_dir': ''
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
def test_saving_tag(tag_factory):
|
def test_saving_tag(tag_factory):
|
||||||
|
|
Loading…
Reference in a new issue