Add tests.
This commit is contained in:
parent
00425b5282
commit
675441cce5
|
@ -1,5 +1,5 @@
|
|||
###
|
||||
# Copyright (c) 2019, Pedro de Oliveira
|
||||
# Copyright (c) 2020, Pedro de Oliveira
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
###
|
||||
# Copyright (c) 2019, Pedro de Oliveira
|
||||
# Copyright (c) 2020, Pedro de Oliveira
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
|
@ -62,6 +62,8 @@ class Anav(callbacks.Plugin):
|
|||
re.sub(r'\s+', ' ', anavnet.get_message(position)['descricao'].replace('\n',' ')).strip())
|
||||
except Exception as e:
|
||||
message = "NOP: {}".format(e)
|
||||
irc.error(message, prefixNick=False)
|
||||
return
|
||||
|
||||
irc.reply(message, prefixNick=False)
|
||||
latest = wrap(latest, ['int', optional('int', default=1)])
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
anavnet
|
16
Anav/test.py
16
Anav/test.py
|
@ -1,5 +1,5 @@
|
|||
###
|
||||
# Copyright (c) 2019, Pedro de Oliveira
|
||||
# Copyright (c) 2020, Pedro de Oliveira
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
|
@ -34,5 +34,19 @@ from supybot.test import *
|
|||
class AnavTestCase(PluginTestCase):
|
||||
plugins = ('Anav',)
|
||||
|
||||
def testPorts(self):
|
||||
self.assertNotError('anav ports')
|
||||
self.assertRegexp('anav ports', r'\d: .*,')
|
||||
self.assertRegexp('anav ports', '16: Lisboa')
|
||||
self.assertHelp('anav ports --help')
|
||||
|
||||
def testLatest(self):
|
||||
self.assertHelp('anav latest')
|
||||
self.assertError('anav latest 666')
|
||||
self.assertError('anav latest -1')
|
||||
self.assertError('anav latest 16 -1')
|
||||
self.assertError('anav latest 16 666')
|
||||
self.assertRegexp('anav latest 16', 'Lisboa')
|
||||
|
||||
|
||||
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:
|
||||
|
|
Loading…
Reference in New Issue