示例#1
0
文件: tests.py 项目: thi517/unisubs
 def test_get_headers(self):
     settings = TeamNotificationSettings(
         header1='Foo: bar',
         header2='  Foo2:  bar2',  # extra space should be trimmed
     )
     assert_equal(settings.get_headers(), {
         'Foo': 'bar',
         'Foo2': 'bar2',
     })
示例#2
0
 def test_send_notification(self):
     team = TeamFactory()
     settings = TeamNotificationSettings(team=team,
                                         type='mock-type',
                                         url='http://example.com/')
     handler = handlers.NotificationHandlerBase(settings)
     data = {'foo': 'bar'}
     handler.send_notification(data)
     # Note: do_http_post gets replaced with a mock function for the
     # unittests
     assert_equal(handlers.do_http_post.delay.call_args,
                  mock.call(team.id, settings.url, data,
                            settings.get_headers(), settings.auth_username,
                            settings.auth_password))