コード例 #1
0
ファイル: tests.py プロジェクト: oslo0322/djhipchat2
    def test_dummy(self):
        backend = get_backend(_backend('dummy'))
        self.assertIsNotNone(backend)

        djhipchat.sent_messages = []
        djhipchat.send_message('1234', 'dummy')
        self.assertEqual([], djhipchat.sent_messages)
コード例 #2
0
    def test_dummy(self):
        backend = get_backend(_backend('dummy'))
        self.assertIsNotNone(backend)

        djhipchat.sent_messages = []
        djhipchat.send_message('1234', 'dummy')
        self.assertEqual([], djhipchat.sent_messages)
コード例 #3
0
def send_message(*args, **kwargs):
    try:
        backend = get_backend(getattr(settings, 'HIPCHAT_CELERY_BACKEND'))
    except AttributeError:
        raise ImproperlyConfigured(
            "You need to specify HIPCHAT_CELERY_BACKEND")

    backend.send_message(*args, **kwargs)
コード例 #4
0
    def test_backend(self):
        backend = get_backend(_backend('celery'))
        self.assertIsNotNone(backend)

        djhipchat.sent_messages = []
        djhipchat.send_message('1234', 'dummy', sender='TestFrom')
        expected = {
            'room_id': '1234',
            'message': 'dummy',
            'from': 'TestFrom',
            'format': 'json',
            'message_format': 'html',
            'notify': 0,
            'color': 'yellow'
        }
        self.assertEqual([expected], djhipchat.sent_messages)
コード例 #5
0
ファイル: tests.py プロジェクト: oslo0322/djhipchat2
    def test_backend(self):
        backend = get_backend(_backend('celery'))
        self.assertIsNotNone(backend)

        djhipchat.sent_messages = []
        djhipchat.send_message('1234', 'dummy', sender='TestFrom')
        expected = {
            'room_id': '1234',
            'message': 'dummy',
            'from': 'TestFrom',
            'format': 'json',
            'message_format': 'html',
            'notify': 0,
            'color': 'yellow'
        }
        self.assertEqual([expected], djhipchat.sent_messages)
コード例 #6
0
    def test_locmem(self):
        backend = get_backend(_backend('locmem'))
        self.assertIsNotNone(backend)

        djhipchat.sent_messages = []
        djhipchat.send_message('1234', 'locmem test', sender='TestFrom')
        # (room_id, message, sender, message_format, notify, color)
        expected = {
            'room_id': '1234',
            'message': 'locmem test',
            'from': 'TestFrom',
            'format': 'json',
            'message_format': 'html',
            'notify': 0,
            'color': 'yellow'
        }
        self.assertEqual([expected], djhipchat.sent_messages)
コード例 #7
0
ファイル: tests.py プロジェクト: oslo0322/djhipchat2
    def test_locmem(self):
        backend = get_backend(_backend('locmem'))
        self.assertIsNotNone(backend)

        djhipchat.sent_messages = []
        djhipchat.send_message('1234', 'locmem test', sender='TestFrom')
        # (room_id, message, sender, message_format, notify, color)
        expected = {
            'room_id': '1234',
            'message': 'locmem test',
            'from': 'TestFrom',
            'format': 'json',
            'message_format': 'html',
            'notify': 0,
            'color': 'yellow'
        }
        self.assertEqual([expected], djhipchat.sent_messages)
コード例 #8
0
 def test_backend_errors(self):
     self.assertRaises(ImproperlyConfigured,
                       lambda: get_backend('djhipchat.foo.BadModule'))
     self.assertRaises(
         ImproperlyConfigured,
         lambda: get_backend('djhipchat.backends.dummy.BadClass'))
コード例 #9
0
ファイル: tests.py プロジェクト: oslo0322/djhipchat2
 def test_backend_errors(self):
     self.assertRaises(ImproperlyConfigured,
                       lambda: get_backend('djhipchat.foo.BadModule'))
     self.assertRaises(ImproperlyConfigured,
                       lambda: get_backend(
                           'djhipchat.backends.dummy.BadClass'))