1
+ import unittest
2
+ import mojang
3
+
4
+ class TestMojangAPI (unittest .TestCase ):
5
+
6
+ def test_existent_uuid (self ):
7
+ self .assertEqual (mojang .get_uuid ('Notch' ), '069a79f444e94726a5befca90e38aaf5' )
8
+ self .assertEqual (mojang .get_uuid ('jeb_' ), '853c80ef3c3749fdaa49938b674adae6' )
9
+
10
+ def test_unexistent_uuid (self ):
11
+ self .assertEqual (mojang .get_uuid ('UNEXISTENT_PLAYER' ), None )
12
+
13
+ def test_existent_uuids (self ):
14
+ self .assertEqual (mojang .get_uuids (['Notch' ,'jeb_' ]), ['069a79f444e94726a5befca90e38aaf5' ,'853c80ef3c3749fdaa49938b674adae6' ])
15
+ self .assertEqual (mojang .get_uuids (['jeb_' ,'Notch' ]), ['853c80ef3c3749fdaa49938b674adae6' ,'069a79f444e94726a5befca90e38aaf5' ])
16
+
17
+ def test_unexistent_uuids (self ):
18
+ self .assertEqual (mojang .get_uuids (['jeb_' ,'UNEXISTENT_PLAYER' ]), ['853c80ef3c3749fdaa49938b674adae6' ,None ])
19
+ self .assertEqual (mojang .get_uuids (['UNEXISTENT_PLAYER1' ,'UNEXISTENT_PLAYER2' ]), [None ,None ])
20
+
21
+ def test_existent_name (self ):
22
+ self .assertEqual (mojang .get_username ('069a79f444e94726a5befca90e38aaf5' ), 'Notch' )
23
+ self .assertEqual (mojang .get_username ('853c80ef3c3749fdaa49938b674adae6' ), 'jeb_' )
24
+
25
+ def test_unexistent_name (self ):
26
+ self .assertEqual (mojang .get_username ('069a79f444e94726a5befca90e38aaf6' ), None )
27
+
28
+ def test_existent_names (self ):
29
+ self .assertEqual (mojang .name_history ('069a79f444e94726a5befca90e38aaf5' ), [('Notch' ,None )])
30
+ self .assertEqual (mojang .name_history ('853c80ef3c3749fdaa49938b674adae6' ), [('jeb_' , None )])
31
+
32
+ def test_unexistent_names (self ):
33
+ self .assertEqual (mojang .name_history ('069a79f444e94726a5befca90e38aaf6' ), [])
34
+
0 commit comments