Example #1
0
 def test_multiple_lines(self, mock_post):
     notify('title', 'message\non multiple\nlines')
     calls = [
         call(syslog.LOG_LOCAL5 | syslog.LOG_ALERT, '[title] message'),
         call(syslog.LOG_LOCAL5 | syslog.LOG_ALERT, 'on multiple'),
         call(syslog.LOG_LOCAL5 | syslog.LOG_ALERT, 'lines'),
     ]
     mock_post.assert_has_calls(calls)
Example #2
0
 def test_fmt(self, mock_post):
     notify('title', 'message', fmt='Title: {title} Message: {message}')
     mock_post.assert_called_once_with(syslog.LOG_LOCAL5 | syslog.LOG_ALERT,
                                       'Title: title Message: message')
Example #3
0
 def test_facility(self, mock_post):
     notify('title', 'message', facility='MAIL')
     mock_post.assert_called_once_with(syslog.LOG_MAIL | syslog.LOG_ALERT,
                                       '[title] message')
Example #4
0
 def test_prio(self, mock_post):
     notify('title', 'message', prio='DEBUG')
     mock_post.assert_called_once_with(syslog.LOG_LOCAL5 | syslog.LOG_DEBUG,
                                       '[title] message')
Example #5
0
 def test_basic(self, mock_post):
     notify('title', 'message')
     mock_post.assert_called_once_with(syslog.LOG_LOCAL5 | syslog.LOG_ALERT,
                                       '[title] message')