Wrap search type enablement status in a search settings class

- Cleaner, more idiomatic usage of a global variable
- Simplifies mocking when testing client in pytest as setting wrapped
  in object rather than a simple type. So passed around by reference
This commit is contained in:
Debanjum Singh Solanky
2021-09-29 19:18:33 -07:00
parent 81ce0cacc3
commit cde11a2331
2 changed files with 25 additions and 16 deletions

View File

@@ -1,4 +1,6 @@
# System Packages
from enum import Enum
from dataclasses import dataclass
class SearchType(str, Enum):
@@ -7,3 +9,12 @@ class SearchType(str, Enum):
Music = "music"
Image = "image"
@dataclass
class SearchSettings():
notes_search_enabled: bool = False
ledger_search_enabled: bool = False
music_search_enabled: bool = False
image_search_enabled: bool = False