-
Notifications
You must be signed in to change notification settings - Fork 6
/
test.py
69 lines (54 loc) · 2.06 KB
/
test.py
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import unittest
from azurlane.azurapi import AzurAPI
class TestStringMethods(unittest.TestCase):
def setUp(self):
self.api = AzurAPI()
def test_get_all_ships(self):
'''
No assertion as this is for general testing
'''
self.api.getAllShips()
def test_get_ship_by_name(self):
ship = self.api.getShipByName(ship='Enterprise')
self.assertEqual(ship['id'], '077')
def test_get_ship_by_id(self):
ship = self.api.getShipById(sid='077')
self.assertEqual(ship['names']['en'], 'Enterprise')
def test_get_ship(self):
'''
Lowecase for 'enterprise' to test case insensitivity
'''
ship_by_name = self.api.getShip(ship='enterprise')
self.assertEqual(ship_by_name['id'], '077')
ship_by_id = self.api.getShip(ship='077')
self.assertEqual(ship_by_id['names']['en'], 'Enterprise')
def test_get_all_ships_by_lang(self):
'''
Test for one language and assume other languages are correct
No assertion as this is for general testing
'''
self.api.getAllShipsByLang('en')
def test_get_ship_by_lang(self):
'''
Test for one language and assume other languages are correct
This effectively also tests for getShipsBy<Lang>Name
'''
ship = self.api.getShipByLang('en', 'Enterprise')
self.assertEqual(ship['id'], '077')
def test_get_all_ships_by_faction(self):
'''
No assertion as this is for general testing
'''
self.api.getAllShipsFromFaction(faction='Sakura Empire')
def test_get_all_equipment_by_lang(self):
'''
No assertion as this is for general testing
'''
gun = self.api.getAllEquipmentsByLang('en')
def test_get_equipment_by_name(self):
'''
Test for one language and assume other languages are correct
'''
gun = self.api.getEquipmentByEnglishName('Prototype Quadruple 356mm Main Gun Mount MkB')
if __name__ == '__main__':
unittest.main(failfast=True)