This repository was archived by the owner on Jun 11, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathtests.py
More file actions
46 lines (31 loc) · 1.28 KB
/
tests.py
File metadata and controls
46 lines (31 loc) · 1.28 KB
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import pytest
import os
from fortnite_python.base import Fortnite
from fortnite_python.domain import Mode, Platform
from fortnite_python.exceptions import UnauthorizedError, UnknownPlayerError
def test_unauthorized():
fortnite = Fortnite('')
pytest.raises(UnauthorizedError, fortnite.player, 'test')
def test_notfound():
fortnite = Fortnite(os.environ.get("fortnite_api_key"))
pytest.raises(UnknownPlayerError, fortnite.player, 'test478941897498893')
def test_platform():
fortnite = Fortnite(os.environ.get("fortnite_api_key"))
# Test wrong Platform
with pytest.raises(AttributeError):
player = fortnite.player('ninja', Platform.playstation)
# Check that if it's empty returns PC platform
player = fortnite.player('ninja')
assert player.platform == 'pc'
player = fortnite.player('ninja', Platform.PC)
assert player.platform == 'pc'
player = fortnite.player('zRotation', Platform.XBOX)
assert player.platform == 'xbox'
player = fortnite.player('AlexRamiGaming', Platform.PSN)
assert player.platform == 'psn'
def test_stats():
fortnite = Fortnite(os.environ.get("fortnite_api_key"))
player = fortnite.player('ninja')
# Test wrong mode
with pytest.raises(AttributeError):
player.getStats(Mode.duo)