Exemplo n.º 1
0
 def test_delete_event_producer(self):
     save_tenant_call = MagicMock()
     with patch('meniscus.data.model.tenant_util.save_tenant',
                save_tenant_call):
         producer_to_delete = self.tenant_obj.event_producers[0]
         tenant_util.delete_event_producer(self.tenant_obj,
                                           producer_to_delete)
         self.assertFalse(
             producer_to_delete in self.tenant_obj.event_producers)
         save_tenant_call.assert_called_once_with(self.tenant_obj)
Exemplo n.º 2
0
 def test_delete_event_producer(self):
     save_tenant_call = MagicMock()
     with patch('meniscus.data.model.tenant_util.save_tenant',
                save_tenant_call):
         producer_to_delete = self.tenant_obj.event_producers[0]
         tenant_util.delete_event_producer(
             self.tenant_obj, producer_to_delete)
         self.assertFalse(
             producer_to_delete in self.tenant_obj.event_producers)
         save_tenant_call.assert_called_once_with(self.tenant_obj)
Exemplo n.º 3
0
    def on_delete(self, req, resp, tenant_id, event_producer_id):
        """
        Delete a specified Event Producer from a Tenant's configuration
        when an HTTP DELETE is received
        """
        #verify the tenant exists
        tenant = tenant_util.find_tenant(tenant_id=tenant_id)

        if not tenant:
            _tenant_not_found()

        #verify the event_producer exists and belongs to the tenant
        event_producer = tenant_util.find_event_producer(
            tenant, producer_id=event_producer_id)
        if not event_producer:
            _producer_not_found()

        tenant_util.delete_event_producer(tenant, event_producer)

        resp.status = falcon.HTTP_200
Exemplo n.º 4
0
    def on_delete(self, req, resp, tenant_id, event_producer_id):
        """
        Delete a specified Event Producer from a Tenant's configuration
        when an HTTP DELETE is received
        """
        #verify the tenant exists
        tenant = tenant_util.find_tenant(tenant_id=tenant_id)

        if not tenant:
            _tenant_not_found()

        #verify the event_producer exists and belongs to the tenant
        event_producer = tenant_util.find_event_producer(
            tenant, producer_id=event_producer_id)
        if not event_producer:
            _producer_not_found()

        tenant_util.delete_event_producer(tenant, event_producer)

        resp.status = falcon.HTTP_200