-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import unittest | ||
import mojang | ||
|
||
class TestMojangAPI(unittest.TestCase): | ||
|
||
def test_existent_uuid(self): | ||
self.assertEqual(mojang.get_uuid('Notch'), '069a79f444e94726a5befca90e38aaf5') | ||
self.assertEqual(mojang.get_uuid('jeb_'), '853c80ef3c3749fdaa49938b674adae6') | ||
|
||
def test_unexistent_uuid(self): | ||
self.assertEqual(mojang.get_uuid('UNEXISTENT_PLAYER'), None) | ||
|
||
def test_existent_uuids(self): | ||
self.assertEqual(mojang.get_uuids(['Notch','jeb_']), ['069a79f444e94726a5befca90e38aaf5','853c80ef3c3749fdaa49938b674adae6']) | ||
self.assertEqual(mojang.get_uuids(['jeb_','Notch']), ['853c80ef3c3749fdaa49938b674adae6','069a79f444e94726a5befca90e38aaf5']) | ||
|
||
def test_unexistent_uuids(self): | ||
self.assertEqual(mojang.get_uuids(['jeb_','UNEXISTENT_PLAYER']), ['853c80ef3c3749fdaa49938b674adae6',None]) | ||
self.assertEqual(mojang.get_uuids(['UNEXISTENT_PLAYER1','UNEXISTENT_PLAYER2']), [None,None]) | ||
|
||
def test_existent_name(self): | ||
self.assertEqual(mojang.get_username('069a79f444e94726a5befca90e38aaf5'), 'Notch') | ||
self.assertEqual(mojang.get_username('853c80ef3c3749fdaa49938b674adae6'), 'jeb_') | ||
|
||
def test_unexistent_name(self): | ||
self.assertEqual(mojang.get_username('069a79f444e94726a5befca90e38aaf6'), None) | ||
|
||
def test_existent_names(self): | ||
self.assertEqual(mojang.name_history('069a79f444e94726a5befca90e38aaf5'), [('Notch',None)]) | ||
self.assertEqual(mojang.name_history('853c80ef3c3749fdaa49938b674adae6'), [('jeb_', None)]) | ||
|
||
def test_unexistent_names(self): | ||
self.assertEqual(mojang.name_history('069a79f444e94726a5befca90e38aaf6'), []) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import unittest | ||
import mojang | ||
|
||
|
||
class TestMojangUser(unittest.TestCase): | ||
|
||
def test_existent_profile(self): | ||
profile = mojang.user('Notch') | ||
self.assertEqual(profile.name, 'Notch') | ||
self.assertEqual(profile.uuid, '069a79f444e94726a5befca90e38aaf5') | ||
self.assertEqual(profile.is_legacy, False) | ||
self.assertEqual(profile.is_demo, False) | ||
self.assertEqual(profile.names, [('Notch', None)]) | ||
|
||
def test_unexistent_profile(self): | ||
self.assertEqual(mojang.user('UNEXISTENT_PLAYER'), None) |