Fix for deleting audit template

We need to update sqlalchemy/api and sqlalchemy/models (and appropriate tests)
to support deleting audit templates and recreating them with the same names.

Change-Id: Icf54cf1ed989a3f2ad689e25be4474b16a3a3eb2
Related-Bug: #1510179
This commit is contained in:
Alexander Chadin
2016-04-04 18:34:20 +03:00
parent 99ff6d3348
commit 3e07844844
4 changed files with 16 additions and 13 deletions

View File

@@ -19,6 +19,7 @@ from six.moves.urllib import parse as urlparse
from wsme import types as wtypes
from watcher.api.controllers.v1 import audit_template as api_audit_template
from watcher.common import exception
from watcher.common import utils
from watcher.db import api as db_api
from watcher import objects
@@ -496,11 +497,10 @@ class TestDelete(api_base.FunctionalTest):
self.assertTrue(response.json['error_message'])
self.context.show_deleted = True
audit_template = objects.AuditTemplate.get_by_name(
self.context, self.audit_template.name)
return_deleted_at = timeutils.strtime(audit_template['deleted_at'])
self.assertEqual(timeutils.strtime(test_time), return_deleted_at)
self.assertRaises(exception.AuditTemplateNotFound,
objects.AuditTemplate.get_by_name,
self.context,
self.audit_template.name)
def test_delete_audit_template_not_found(self):
uuid = utils.generate_uuid()