1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
# __init__.py -- The tests for prometheus_xmpp
# Copyright (C) 2018 Jelmer Vernooij <jelmer@jelmer.uk>
#
import unittest
from prometheus_xmpp import create_message
class CreateMessageTests(unittest.TestCase):
def test_create_message(self):
message = {
'alerts': [
{
'startsAt': '2018-12-12',
'annotations': {
'summary': 'Something',
},
}
],
'status': 'firing',
}
self.assertEqual(
['FIRING, 1/1, 2018-12-12, Something'],
list(create_message(message)))
def test_suite():
module_names = ['prometheus_xmpp.tests']
loader = unittest.TestLoader()
return loader.loadTestsFromNames(module_names)
|