Example #1
0
 def test_package_not_exists(self):
     self._mock_pika()
     with self.assertRaises(ImportError):
         napi = Napi()
         kind = {
             'package': 'globomap_driver_napi.not_exists',
             'class': 'Kind',
             'method': 'vip',
         }
         napi._treat_message(kind, None)
Example #2
0
 def test_class_not_exists(self):
     self._mock_pika()
     with self.assertRaises(AttributeError):
         napi = Napi()
         kind = {
             'package': 'globomap_driver_napi.kind',
             'class': 'NotExists',
             'method': 'vip',
         }
         napi._treat_message(kind, None)
    def test_pool_comp_unit_treat_message_delete(self):
        self._mock_pika()

        napi = Napi()
        kind = MAP_FUNC.get('ServerPoolMember')[0]
        message = self._make_message('Remover', 'ServerPoolMember')
        data = napi._treat_message(kind, message)

        self._asset_msg_delete('napi', 'pool_comp_unit', 'edges', data)
    def test_vip_treat_message_delete(self):
        self._mock_pika()

        napi = Napi()
        kind = MAP_FUNC.get('VipRequest')[0]
        message = self._make_message('Remover', 'VipRequest')
        data = napi._treat_message(kind, message)

        self._asset_msg_delete('napi', 'vip', 'collections', data)
    def test_pool_treat_message_delete(self):
        self._mock_pika()

        napi = Napi()
        kind = MAP_FUNC.get('ServerPool')[0]
        message = self._make_message('Remover', 'ServerPool')
        data = napi._treat_message(kind, message)

        self._asset_msg_delete('napi', 'pool', 'collections', data)
    def test_port_treat_message_delete(self):
        self._mock_pika()

        napi = Napi()
        kind = MAP_FUNC.get('VipRequestPortPool')[0]
        message = self._make_message('Remover', 'VipRequestPortPool')
        data = napi._treat_message(kind, message)

        self._asset_msg_delete('napi', 'port', 'edges', data)
Example #7
0
    def test_port_treat_message_delete(self):
        self._mock_pika()

        napi = Napi()
        kind = MAP_FUNC.get('VipRequestPortPool')[0]
        message = self._make_message('Remover', 'VipRequestPortPool')
        data = napi._treat_message(kind, message)

        self._asset_msg_delete('napi', 'port', 'edges', data)
Example #8
0
    def test_vip_treat_message_delete(self):
        self._mock_pika()

        napi = Napi()
        kind = MAP_FUNC.get('VipRequest')[0]
        message = self._make_message('Remover', 'VipRequest')
        data = napi._treat_message(kind, message)

        self._asset_msg_delete('napi', 'vip', 'collections', data)
Example #9
0
    def test_pool_comp_unit_treat_message_delete(self):
        self._mock_pika()

        napi = Napi()
        kind = MAP_FUNC.get('ServerPoolMember')[0]
        message = self._make_message('Remover', 'ServerPoolMember')
        data = napi._treat_message(kind, message)

        self._asset_msg_delete('napi', 'pool_comp_unit', 'edges', data)
Example #10
0
    def test_pool_treat_message_delete(self):
        self._mock_pika()

        napi = Napi()
        kind = MAP_FUNC.get('ServerPool')[0]
        message = self._make_message('Remover', 'ServerPool')
        data = napi._treat_message(kind, message)

        self._asset_msg_delete('napi', 'pool', 'collections', data)
Example #11
0
    def test_pool_treat_message_create(self):
        self._mock_pika()
        self._mock_pool()

        napi = Napi()
        kind = MAP_FUNC.get('ServerPool')[0]
        message = self._make_message('Cadastrar', 'ServerPool')
        data = napi._treat_message(kind, message)

        self._assert_pool('CREATE', data)
Example #12
0
    def test_port_treat_message_update(self):
        self._mock_pika()
        self._mock_vip_by_portpool_id()

        napi = Napi()
        kind = MAP_FUNC.get('VipRequestPortPool')[0]
        message = self._make_message('Alterar', 'VipRequestPortPool')
        data = napi._treat_message(kind, message)

        self._assert_port('UPDATE', data)
Example #13
0
    def test_vip_treat_message_create(self):
        self._mock_pika()
        self._mock_vip()

        napi = Napi()
        kind = MAP_FUNC.get('VipRequest')[0]
        message = self._make_message('Cadastrar', 'VipRequest')
        data = napi._treat_message(kind, message)

        self._assert_vip('CREATE', data)
Example #14
0
    def test_pool_comp_unit_treat_message_update(self):
        self._mock_pika()
        self._mock_pool_member_id()

        napi = Napi()
        kind = MAP_FUNC.get('ServerPoolMember')[0]
        message = self._make_message('Alterar', 'ServerPoolMember')
        data = napi._treat_message(kind, message)

        self._assert_pool_comp_unit('UPDATE', data)
Example #15
0
    def test_msg_dont_treated(self):
        self._mock_pika()
        napi = Napi()

        data = self._open_message()[0:1]
        self._mock_consumer(data)

        napi._treat_message = Mock(return_value=False)
        with self.assertRaises(StopIteration):
            napi.next_message()
    def test_pool_comp_unit_treat_message_update(self):
        self._mock_pika()
        self._mock_pool_member_id()

        napi = Napi()
        kind = MAP_FUNC.get('ServerPoolMember')[0]
        message = self._make_message('Alterar', 'ServerPoolMember')
        data = napi._treat_message(kind, message)

        self._assert_pool_comp_unit('UPDATE', data)
    def test_vip_treat_message_create(self):
        self._mock_pika()
        self._mock_vip()

        napi = Napi()
        kind = MAP_FUNC.get('VipRequest')[0]
        message = self._make_message('Cadastrar', 'VipRequest')
        data = napi._treat_message(kind, message)

        self._assert_vip('CREATE', data)
    def test_pool_treat_message_create(self):
        self._mock_pika()
        self._mock_pool()

        napi = Napi()
        kind = MAP_FUNC.get('ServerPool')[0]
        message = self._make_message('Cadastrar', 'ServerPool')
        data = napi._treat_message(kind, message)

        self._assert_pool('CREATE', data)
    def test_port_treat_message_update(self):
        self._mock_pika()
        self._mock_vip_by_portpool_id()

        napi = Napi()
        kind = MAP_FUNC.get('VipRequestPortPool')[0]
        message = self._make_message('Alterar', 'VipRequestPortPool')
        data = napi._treat_message(kind, message)

        self._assert_port('UPDATE', data)