mirror of
https://github.com/lucaspalomodevelop/Party.git
synced 2026-03-13 00:07:21 +00:00
corrected tests
This commit is contained in:
parent
75f241f7fd
commit
58713a71d9
@ -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
18
party/mate.py
Normal 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
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user