Exemplo n.º 1
0
    def test_edit_rules_delete_rule(self):
        RULE_ID = '1'

        self.mox.StubOutWithMock(api, 'security_group_rule_delete')
        api.security_group_rule_delete(IsA(http.HttpRequest), RULE_ID)

        self.mox.ReplayAll()

        form_data = {"action": "rules__delete__%s" % RULE_ID}
        req = self.factory.post(SG_EDIT_RULE_URL, form_data)
        table = RulesTable(req, self.rules)
        handled = table.maybe_handle()

        self.assertEqual(handled['location'], SG_EDIT_RULE_URL)
Exemplo n.º 2
0
 def single(self, table, request, obj_id):
     tenant_id = request.user.tenant_id
     obj = table.get_object_by_id(int(obj_id))
     try:
         LOG.info('Delete security_group_rule: "%s"' % obj_id)
         security_group = api.security_group_rule_delete(request, obj_id)
         messages.info(request, _('Successfully deleted rule: %s')
                                 % obj_id)
     except engineclient_exceptions.ClientException, e:
         LOG.exception("ClientException in DeleteRule")
         messages.error(request, _('Error authorizing security group: %s')
                                  % e.message)