forked from ScoDoc/ScoDoc
add test for delete_logo
This commit is contained in:
parent
2f4be9b949
commit
ee5b610da4
|
@ -17,7 +17,14 @@ import app
|
|||
from app import db
|
||||
from app.models import Departement
|
||||
import app.scodoc.sco_utils as scu
|
||||
from app.scodoc.sco_logos import find_logo, Logo, list_logos, GLOBAL, write_logo
|
||||
from app.scodoc.sco_logos import (
|
||||
find_logo,
|
||||
Logo,
|
||||
list_logos,
|
||||
GLOBAL,
|
||||
write_logo,
|
||||
delete_logo,
|
||||
)
|
||||
|
||||
RESOURCES_DIR = "/opt/scodoc/tests/ressources/test_logos"
|
||||
|
||||
|
@ -142,7 +149,16 @@ def test_get_png_without_data(create_dept, create_logos):
|
|||
assert logo.mm is None
|
||||
|
||||
|
||||
def test_create_globale_jpg_logo(create_dept, create_logos):
|
||||
def test_delete_global_jpg_logo(create_dept, create_logos):
|
||||
from_path = Path(RESOURCES_DIR).joinpath("logo_A.jpg")
|
||||
to_path = Path(scu.SCODOC_LOGOS_DIR).joinpath("logo_W.jpg")
|
||||
copy(from_path.absolute(), to_path.absolute())
|
||||
assert to_path.exists()
|
||||
delete_logo(name="W")
|
||||
assert not to_path.exists()
|
||||
|
||||
|
||||
def test_create_global_jpg_logo(create_dept, create_logos):
|
||||
path = Path(f"{RESOURCES_DIR}/logo_C.jpg")
|
||||
stream = path.open("rb")
|
||||
logo_path = Path(scu.SCODOC_LOGOS_DIR).joinpath("logo_X.jpg")
|
||||
|
@ -189,7 +205,7 @@ def test_list_logo(create_dept, create_logos):
|
|||
# test only existence of copied logos. We assumes that they are OK
|
||||
dept1, dept2, dept3 = create_dept
|
||||
logos = list_logos()
|
||||
assert set(logos.keys()) == { dept1.id, dept2.id, None }
|
||||
assert set(logos.keys()) == {dept1.id, dept2.id, None}
|
||||
assert {"A", "C", "D", "E", "F", "header", "footer"}.issubset(
|
||||
set(logos[None].keys())
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue
Block a user