blob: 38e377fb76b2db0cc207789ef8a4fd9a75739e39 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
from os import remove
from random import randint
from pathlib import PurePath
from names import get_first_name, get_last_name
from match_up.model import Player, PlayerDatabase
TEST_DATABASE_LOCATION = PurePath("test_storage.json")
MIN_SKILL = 1
MAX_SKILL = 10
def generate_test_database(total_players: int = 20, active_players: int = 17) -> None:
p = PlayerDatabase(TEST_DATABASE_LOCATION)
for _ in range(total_players):
p.add_player(
Player(
first_name=get_first_name(),
last_name=get_last_name(),
skill=randint(MIN_SKILL, MAX_SKILL),
)
)
def remove_test_database() -> None:
remove(TEST_DATABASE_LOCATION)
|