Beispiel #1
0
 def test_vogeler_server_init(self):
     """Test that creating a Server object works"""
     c = VogelerServer(callback_function=self.echo,
                     host='localhost',
                     username='******',
                     password='******')
     self.assertType(c, 'vogeler.vogeler.VogelerServer')
     c.close()
Beispiel #2
0
 def test_server_message_nondurable(self):
     """Test that server can send non-durable messages"""
     test_message = 'this is a test'
     c = VogelerServer(callback_function=self.echo,
                     host='localhost',
                     username='******',
                     password='******')
     self.assertIsNone(c.message(test_message, durable=False))
     c.close()
Beispiel #3
0
 def test_server_callback(self):
     """Test that server callbacks work"""
     sample_text = 'this is a test'
     message_body = json.dumps(sample_text)
     test_message = message.SampleMessage(message_body)
     c = VogelerServer(callback_function=None,
                     host='localhost',
                     username='******',
                     password='******')
     m = c.callback(test_message)
     self.assertEquals(m.message, sample_text)
     c.close()
Beispiel #4
0
 def test_server_callback(self):
     """Test that server callbacks work"""
     sample_text = 'this is a test'
     message_body = json.dumps(sample_text)
     test_message = message.SampleMessage(message_body)
     c = VogelerServer(callback_function=self.echo,
                     role='server',
                     host='localhost',
                     username='******',
                     password='******')
     m = c.ch.basic_consume(c.queue, callback=c.callback, no_ack=True)
     self.assertEquals(m.message, sample_text)
     c.close()
Beispiel #5
0
 def test_server_message_nondurable(self):
     """Test that server can send non-durable messages"""
     test_message = 'this is a test'
     c = VogelerServer(callback_function=self.echo, role='server', dsn=self.good_amqp_dsn)
     self.assertIsNone(c.message(test_message, durable=False))
     c.close()
Beispiel #6
0
 def test_vogeler_server_failure(self):
     """Test that Server object fails properly"""
     with self.assertRaises(Exception):
         VogelerServer(callback_function=self.echo, role='server', dsn=self.bad_amqp_dsn)
Beispiel #7
0
 def test_vogeler_server_init(self):
     """Test that creating a Server object works"""
     c = VogelerServer(callback_function=self.echo, role='server', dsn=self.good_amqp_dsn)
     self.assertType(c, 'vogeler.vogeler.VogelerServer')
     c.close()