corrected tests

This commit is contained in:
hyperbel 2023-07-05 15:43:58 +02:00
parent 75f241f7fd
commit 58713a71d9
4 changed files with 39 additions and 5 deletions

View File

@ -10,6 +10,11 @@ class Database(Enum):
Users = 1
Games = 2
class MateMarke(Enum):
ClubMate = "Club Mate"
FloraPower = "Flora Power"
MioMioMate = "MioMio Mate"
messagesDB = redis.Redis(host='localhost', port=6379, db=Database.Messages.value)
users = redis.Redis(host='localhost', port=6379, db=Database.Users.value)
games = redis.Redis(host='localhost', port=6379, db=Database.Games.value)

18
party/mate.py Normal file
View File

@ -0,0 +1,18 @@
from party import MateMarke as Marke
class MateKiste:
def __init__(self, flaschen_anzahl: int, marke: Marke):
self.flaschen_anzahl = flaschen_anzahl
self.marke = marke
def eineTrinken(self):
self.flaschen_anzahl = self.flaschen_anzahl - 1
def getFlaschenAnzahl(self) -> int:
return self.flaschen_anzahl
def getMarke(self) -> Marke:
return self.marke
def getMarkeName(self) -> str:
return self.marke.value

View File

@ -1,6 +1,7 @@
import pytest
from party import create_app, Database, chat as c
from party import create_app, Database, chat as c, MateMarke
from party import message as m
from party.mate import MateKiste
@pytest.fixture
@ -28,3 +29,9 @@ def chat():
def message():
message = m.Message('author', 'content', 'timestamp', 0)
yield message
@pytest.fixture
def mateKiste():
mateKiste = MateKiste(20, MateMarke.ClubMate)
yield mateKiste

View File

@ -27,10 +27,14 @@ class TestChat:
assert len(messages) > 0
assert type(messages) == list
assert type(messages[0]) == dict
assert type(messages[0]['content']) == str
assert type(messages[0]['author']) == str
assert type(messages[0]['timestamp']) == str
assert type(messages[0]['id']) == int
assert b'content' in messages[0]
assert b'author' in messages[0]
assert b'timestamp' in messages[0]
assert b'id' in messages[0]
assert type(messages[0][b"content"]) == bytes
assert type(messages[0][b"author"]) == bytes
assert type(messages[0][b"timestamp"]) == bytes
assert messages[0][b"id"].isdigit()
def test_convertToMessage(self, chat):
message = chat.convertToMessage('test', 'test', 'test', 0)