From 0e480ccebecd7bbb0282833ad044fc909d63fb60 Mon Sep 17 00:00:00 2001 From: Joey Hines Date: Fri, 21 Sep 2018 19:58:56 -0500 Subject: [PATCH] Updated more tests --- geoffrey/Commands.py | 3 --- geoffrey/tests/test_commands.py | 29 ++++++++++++++++++++++++++--- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/geoffrey/Commands.py b/geoffrey/Commands.py index 8f678e6..eeab435 100644 --- a/geoffrey/Commands.py +++ b/geoffrey/Commands.py @@ -228,9 +228,6 @@ class Commands: session.commit() loc_str = location.__str__() - except IntegrityError: - session.rollback() - raise EntryNameNotUniqueError except DataError: session.rollback() raise DatabaseValueError diff --git a/geoffrey/tests/test_commands.py b/geoffrey/tests/test_commands.py index 2eaa320..bc67313 100644 --- a/geoffrey/tests/test_commands.py +++ b/geoffrey/tests/test_commands.py @@ -220,8 +220,6 @@ class TestCommands(TestCase): else: self.fail() - - def test_edit_name(self): self.commands.register(zerohd, '143072699567177728') self.commands.add_shop(0, 0, shop_name='test shop', discord_uuid='143072699567177728') @@ -255,6 +253,12 @@ class TestCommands(TestCase): else: self.fail() + self.assertRaises(DatabaseValueError, self.commands.edit_pos, 9999999999999999999999999999999999999999999999999, + 5, None, discord_uuid='143072699567177728') + + self.assertRaises(LocationLookUpError, self.commands.edit_pos, 5, 5, 'henlo', + discord_uuid='143072699567177728') + self.commands.delete(name='test shop', discord_uuid='143072699567177728') self.assertRaises(NoLocationsInDatabase, self.commands.edit_pos, 5, 5, None, @@ -273,6 +277,15 @@ class TestCommands(TestCase): else: self.fail() + self.commands.edit_tunnel("East", 500, 'test shop', discord_uuid='143072699567177728') + + result = self.commands.info('test shop') + + if "East" in result: + pass + else: + self.fail() + def test_delete_item(self): self.commands.register(zerohd, '143072699567177728') self.commands.add_shop(0, 0, shop_name='test shop', discord_uuid='143072699567177728') @@ -324,4 +337,14 @@ class TestCommands(TestCase): self.commands.update_discord_uuid('143072699567177728', '0') self.assertRaises(PlayerNotFound, self.commands.add_shop, 0, 0, shop_name='test shop', - discord_uuid='143072699567177728') \ No newline at end of file + discord_uuid='143072699567177728') + + def test_add_player(self): + self.commands.add_player('143072699567177728', zerohd) + + self.assertRaises(PlayerInDBError, self.commands.add_player, '143072699567177728', zerohd) + + if zerohd in self.commands.find_player('143072699567177728'): + pass + else: + self.fail()