From 35da7264c7ad00524c4815d45dda23e1edcaaa64 Mon Sep 17 00:00:00 2001 From: Rob Date: Thu, 4 Jun 2015 10:26:48 +0100 Subject: [PATCH 1/3] Add a test to look for Carnyx items. --- tests/test_bot.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/test_bot.py b/tests/test_bot.py index 4c99e52..a8af6cb 100644 --- a/tests/test_bot.py +++ b/tests/test_bot.py @@ -149,3 +149,9 @@ class DropBotTestCase(TestCase): def test_cmd_rageping(self): pass + + def test_carnyx_items(self): + """ + The items in the Carnyx release can be found. + """ + self.assertEqual(self.bot._item_picker("Jackdaw"), (u'34828', u'Jackdaw')) From 034fb3a2dd52e3fe73f34016e530fc99096c016d Mon Sep 17 00:00:00 2001 From: Rob Date: Thu, 4 Jun 2015 10:45:12 +0100 Subject: [PATCH 2/3] Fix up looking for plex. --- dropbot/bot.py | 3 ++- tests/test_bot.py | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dropbot/bot.py b/dropbot/bot.py index c0c7014..9f240f4 100644 --- a/dropbot/bot.py +++ b/dropbot/bot.py @@ -174,7 +174,7 @@ class DropBot(ClientXMPP): if item.strip() == '': return 'Usage: !price ' if item.lower() == 'plex': - item = '30 Day' + return (u"29668", u"30 Day Pilot's License Extension (PLEX)") types = dict([(i, v) for i, v in self.types.iteritems() if item.lower() in v.lower()]) if len(types) == 0: return "No items named {} found".format(item) @@ -184,6 +184,7 @@ class DropBot(ClientXMPP): return (i, v) else: if len(types) > 10: + import pdb; pdb.set_trace() return "More than 10 items found, please narrow down what you want." return "Did you mean: {}?".format( ', '.join(types.itervalues()) diff --git a/tests/test_bot.py b/tests/test_bot.py index a8af6cb..da14ec1 100644 --- a/tests/test_bot.py +++ b/tests/test_bot.py @@ -150,8 +150,11 @@ class DropBotTestCase(TestCase): def test_cmd_rageping(self): pass - def test_carnyx_items(self): + def test_jackdaw(self): """ The items in the Carnyx release can be found. """ self.assertEqual(self.bot._item_picker("Jackdaw"), (u'34828', u'Jackdaw')) + + def test_carnyx_plex(self): + self.assertEqual(self.bot._item_picker("plex"), (u"29668", "30 Day Pilot's License Extension (PLEX)")) From 39eb3b9b0e29ef2a218266cbf545c1252f3629e9 Mon Sep 17 00:00:00 2001 From: Rob Date: Thu, 4 Jun 2015 10:46:04 +0100 Subject: [PATCH 3/3] Probably don' want to include pdb in the live code huh. --- dropbot/bot.py | 1 - 1 file changed, 1 deletion(-) diff --git a/dropbot/bot.py b/dropbot/bot.py index 9f240f4..b2d8f69 100644 --- a/dropbot/bot.py +++ b/dropbot/bot.py @@ -184,7 +184,6 @@ class DropBot(ClientXMPP): return (i, v) else: if len(types) > 10: - import pdb; pdb.set_trace() return "More than 10 items found, please narrow down what you want." return "Did you mean: {}?".format( ', '.join(types.itervalues())