Coverage for functions \ flipdare \ app_defaults.py: 87%
15 statements
« prev ^ index » next coverage.py v7.13.0, created at 2026-05-08 12:22 +1000
« prev ^ index » next coverage.py v7.13.0, created at 2026-05-08 12:22 +1000
1#!/usr/bin/env python
2# Copyright (c) 2026 Flipdare Pty Ltd. All rights reserved.
3#
4# This file is part of Flipdare's proprietary software and contains
5# confidential and copyrighted material. Unauthorised copying,
6# modification, distribution, or use of this file is strictly
7# prohibited without prior written permission from Flipdare Pty Ltd.
8#
9# This software includes third-party components licensed under MIT,
10# BSD, and Apache 2.0 licences. See THIRD_PARTY_NOTICES for details.
11#
13from __future__ import annotations
15from typing import TYPE_CHECKING
17if TYPE_CHECKING:
19 from flipdare.generated.model.internal.image_model import ImageModel
21# RELEASE: FLP-636 - create fallback images if signing fails.
23__all__ = [
24 "get_fallback_avatar_image",
25 "get_fallback_avatar",
26]
29_FALLBACK_IMAGES = [
30 "https://flipdare.com/fallback/1.png",
31 "https://flipdare.com/fallback/2.png",
32 "https://flipdare.com/fallback/3.png",
33 "https://flipdare.com/fallback/4.png",
34 "https://flipdare.com/fallback/5.png",
35]
37_FALLBACK_AVATARS = [
38 "https://flipdare.com/fallback/avatar1.png",
39 "https://flipdare.com/fallback/avatar2.png",
40 "https://flipdare.com/fallback/avatar3.png",
41 "https://flipdare.com/fallback/avatar4.png",
42 "https://flipdare.com/fallback/avatar5.png",
43]
45_ADMIN_UIDS = [
46 "admin-uid-1",
47 "admin-uid-2",
48 "admin-uid-3",
49]
52def get_fallback_avatar_image() -> str:
53 from random import choice
55 return choice(_FALLBACK_IMAGES) # noqa: S311
58def get_fallback_avatar() -> ImageModel:
59 from random import choice
60 from flipdare.generated.model.internal.image_model import ImageModel
61 from flipdare.generated.model.internal.stored_file_model import StoredFileModel
63 img_url = choice(_FALLBACK_AVATARS) # noqa: S311
64 return ImageModel(
65 source=StoredFileModel(url=img_url, file_size=1024, uid=_ADMIN_UIDS[0]), # dummy value
66 w=512,
67 h=512,
68 )