File: __init__.py

package info (click to toggle)
prometheus-xmpp-alerts 0.3%2Bgit20190128.4c8868d-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 116 kB
  • sloc: python: 171; makefile: 2
file content (32 lines) | stat: -rw-r--r-- 816 bytes parent folder | download
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)