Fix MessageConfig
MessageConfig is a dictionary, but __init__ was updating __dict__ and not self. This bug was causing elastic-recheck to stacktrace when it tries to comment on a gerrit patch. Change-Id: Ic4304336692226acfe60d0845edaf2acb383acc6
This commit is contained in:
parent
40346c1d98
commit
e9c4450cf8
@ -218,7 +218,8 @@ class RecheckWatch(threading.Thread):
|
|||||||
|
|
||||||
class MessageConfig(dict):
|
class MessageConfig(dict):
|
||||||
def __init__(self, data):
|
def __init__(self, data):
|
||||||
self.__dict__.update(data['messages'])
|
super(MessageConfig, self).__init__()
|
||||||
|
self.update(data['messages'])
|
||||||
|
|
||||||
|
|
||||||
class ChannelConfig(object):
|
class ChannelConfig(object):
|
||||||
|
@ -135,3 +135,8 @@ class TestBotWithTestTools(tests.TestCase):
|
|||||||
job.bugs = ['123456']
|
job.bugs = ['123456']
|
||||||
self.assertTrue(self.recheck_watch.display('channel', event))
|
self.assertTrue(self.recheck_watch.display('channel', event))
|
||||||
self.recheck_watch.error_found('channel', event)
|
self.recheck_watch.error_found('channel', event)
|
||||||
|
|
||||||
|
def test_message_config(self):
|
||||||
|
data = {'messages': {'test': 'message'}}
|
||||||
|
config = bot.MessageConfig(data)
|
||||||
|
self.assertEqual(config['test'], data['messages']['test'])
|
||||||
|
Loading…
Reference in New Issue
Block a user