Esempio n. 1
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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 5
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)
Esempio n. 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)
Esempio n. 7
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)
Esempio n. 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'))
Esempio n. 9
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'))