コード例 #1
0
ファイル: test_connection.py プロジェクト: credativ/gofer
 def test_close_failed(self):
     url = 'test-url'
     c = Connection(url)
     impl = Mock()
     impl.close.side_effect = ValueError
     c._impl = impl
     c.close()
コード例 #2
0
ファイル: test_connection.py プロジェクト: pombreda/gofer
 def test_close_failed(self):
     url = 'test-url'
     c = Connection(url)
     impl = Mock()
     impl.close.side_effect = ValueError
     c._impl = impl
     c.close()
コード例 #3
0
ファイル: test_connection.py プロジェクト: pombreda/gofer
 def test_close(self):
     url = 'test-url'
     c = Connection(url)
     impl = Mock()
     c._impl = impl
     c.close()
     impl.close.assert_called_once_with()
     self.assertEqual(c._impl, None)
コード例 #4
0
ファイル: test_connection.py プロジェクト: credativ/gofer
 def test_close(self):
     url = 'test-url'
     c = Connection(url)
     impl = Mock()
     c._impl = impl
     c.close()
     impl.close.assert_called_once_with()
     self.assertEqual(c._impl, None)
コード例 #5
0
ファイル: test_connection.py プロジェクト: credativ/gofer
    def test_sender(self, uuid):
        url = 'test-url'
        address = 'test'
        uuid.return_value = '1234'
        connection = Connection(url)
        connection._impl = Mock()

        # test
        sender = connection.sender(address)

        # validation
        connection._impl.create_sender.assert_called_once_with(address, name=uuid.return_value)
        self.assertEqual(sender, connection._impl.create_sender.return_value)
コード例 #6
0
ファイル: test_connection.py プロジェクト: pombreda/gofer
    def test_sender(self, uuid):
        url = 'test-url'
        address = 'test'
        uuid.return_value = '1234'
        connection = Connection(url)
        connection._impl = Mock()

        # test
        sender = connection.sender(address)

        # validation
        connection._impl.create_sender.assert_called_once_with(
            address, name=uuid.return_value)
        self.assertEqual(sender, connection._impl.create_sender.return_value)
コード例 #7
0
ファイル: test_connection.py プロジェクト: credativ/gofer
    def test_dynamic_receiver(self, uuid, properties):
        url = 'test-url'
        address = 'test'
        uuid.return_value = '1234'
        connection = Connection(url)
        connection._impl = Mock()

        # test
        receiver = connection.receiver(address, dynamic=True)

        # validation
        properties.assert_called_once_with({'x-opt-qd.address': address})
        connection._impl.create_receiver.assert_called_once_with(
            None, dynamic=True, name=uuid.return_value, options=properties.return_value)
        self.assertEqual(receiver, connection._impl.create_receiver.return_value)
コード例 #8
0
ファイル: test_connection.py プロジェクト: credativ/gofer
    def test_receiver(self, uuid, properties):
        url = 'test-url'
        address = 'test'
        uuid.return_value = '1234'
        connection = Connection(url)
        connection._impl = Mock()

        # test
        receiver = connection.receiver(address)

        # validation
        connection._impl.create_receiver.assert_called_once_with(
            address, dynamic=False, name=uuid.return_value, options=None)
        self.assertEqual(receiver, connection._impl.create_receiver.return_value)
        self.assertFalse(properties.called)
コード例 #9
0
ファイル: test_connection.py プロジェクト: pombreda/gofer
    def test_receiver(self, uuid, properties):
        url = 'test-url'
        address = 'test'
        uuid.return_value = '1234'
        connection = Connection(url)
        connection._impl = Mock()

        # test
        receiver = connection.receiver(address)

        # validation
        connection._impl.create_receiver.assert_called_once_with(
            address, dynamic=False, name=uuid.return_value, options=None)
        self.assertEqual(receiver,
                         connection._impl.create_receiver.return_value)
        self.assertFalse(properties.called)
コード例 #10
0
ファイル: test_connection.py プロジェクト: pombreda/gofer
    def test_dynamic_receiver(self, uuid, properties):
        url = 'test-url'
        address = 'test'
        uuid.return_value = '1234'
        connection = Connection(url)
        connection._impl = Mock()

        # test
        receiver = connection.receiver(address, dynamic=True)

        # validation
        properties.assert_called_once_with({'x-opt-qd.address': address})
        connection._impl.create_receiver.assert_called_once_with(
            None,
            dynamic=True,
            name=uuid.return_value,
            options=properties.return_value)
        self.assertEqual(receiver,
                         connection._impl.create_receiver.return_value)
コード例 #11
0
ファイル: test_connection.py プロジェクト: pombreda/gofer
 def test_is_open(self):
     connection = Connection('')
     self.assertFalse(connection.is_open())
     connection._impl = Mock()
     self.assertTrue(connection.is_open())
コード例 #12
0
ファイル: test_connection.py プロジェクト: credativ/gofer
 def test_is_open(self):
     connection = Connection('')
     self.assertFalse(connection.is_open())
     connection._impl = Mock()
     self.assertTrue(connection.is_open())