mirror of
https://github.com/nikdoof/dropbot.git
synced 2025-12-21 05:39:27 +00:00
More tests, few small fixes.
This commit is contained in:
@@ -21,7 +21,7 @@ market_systems = [
|
||||
|
||||
|
||||
class DropBot(ClientXMPP):
|
||||
def __init__(self, **kwargs):
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.rooms = kwargs.pop('rooms', [])
|
||||
self.nickname = kwargs.pop('nickname', 'Dropbot')
|
||||
self.cmd_prefix = kwargs.pop('cmd_prefix', '!')
|
||||
@@ -31,7 +31,7 @@ class DropBot(ClientXMPP):
|
||||
self.redis_conn = Redis()
|
||||
self.map = Map.from_json(pkgutil.get_data('dropbot', 'data/map.json'))
|
||||
|
||||
super(DropBot, self).__init__(**kwargs)
|
||||
super(DropBot, self).__init__(*args, **kwargs)
|
||||
self.register_plugin('xep_0030') # Service Discovery
|
||||
self.register_plugin('xep_0045') # Multi-User Chat
|
||||
self.register_plugin('xep_0199') # XMPP Ping
|
||||
|
||||
11
setup.py
11
setup.py
@@ -7,15 +7,20 @@ try:
|
||||
except ImportError:
|
||||
from distutils.core import setup
|
||||
|
||||
|
||||
readme = open('README.md').read()
|
||||
|
||||
requirements = [
|
||||
# TODO: put package requirements here
|
||||
'sleekxmpp==1.3.1',
|
||||
'eveapi==1.2.6',
|
||||
'redis==2.10.2',
|
||||
'requests==2.3.0',
|
||||
'humanize==0.5',
|
||||
'dnspython==1.11.1',
|
||||
'networkx==1.9',
|
||||
]
|
||||
|
||||
test_requirements = [
|
||||
# TODO: put package test requirements here
|
||||
'mock==1.0.1',
|
||||
]
|
||||
|
||||
setup(
|
||||
|
||||
23
tests/test_bot.py
Normal file
23
tests/test_bot.py
Normal file
@@ -0,0 +1,23 @@
|
||||
from unittest import TestCase
|
||||
from dropbot.bot import DropBot
|
||||
|
||||
|
||||
class DropBotTestCase(TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.bot = DropBot('test@test.com', 'testpassword')
|
||||
|
||||
def test_simple_bot(self):
|
||||
self.assertIsNotNone(self.bot)
|
||||
|
||||
def test_system_picker(self):
|
||||
self.assertEquals(self.bot._system_picker('Jita'), 30000142)
|
||||
self.assertEquals(self.bot._system_picker('Jit'), 30000142)
|
||||
self.assertIs(type(self.bot._system_picker('J')), str)
|
||||
self.assertEqual(self.bot._system_picker('J'), 'More than 10 systems match J, please provide a more complete name')
|
||||
self.assertEqual(self.bot._system_picker('GE-'), 'Did you mean: GGE-5Q, GE-94X, GE-8JV, IGE-NE, IGE-RI?')
|
||||
self.assertEqual(self.bot._system_picker('asdasd'), 'No systems found matching asdasd')
|
||||
|
||||
def test_get_evecentral_price(self):
|
||||
self.assertIs(self.bot._get_evecentral_price(1,1), None)
|
||||
self.assertIs(type(self.bot._get_evecentral_price(22430, 30000142)), tuple)
|
||||
@@ -24,6 +24,9 @@ class MapTestCase(TestCase):
|
||||
self.assertEquals(len(self.map.get_systems('Ji')), 14)
|
||||
self.assertEquals(len(self.map.get_systems('J')), 576)
|
||||
self.assertEquals(len(self.map.get_systems('123435345345')), 0)
|
||||
self.assertEquals(len(self.map.get_systems('jita')), 1)
|
||||
self.assertEquals(len(self.map.get_systems('JITA')), 1)
|
||||
self.assertEquals(len(self.map.get_systems('JiTa')), 1)
|
||||
|
||||
def test_system_distance(self):
|
||||
self.assertEqual(self.map.system_distance(30000142, 30000144), 2.10268108033618)
|
||||
|
||||
Reference in New Issue
Block a user