Use Enum value instead of String Value

Bug #1634180 reported by David TARDIVEL
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
watcher
Fix Released
Low
Atul Pandey

Bug Description

In the Watcher source code, we have again some code like this:

https://github.com/openstack/watcher/blob/master/watcher/objects/action.py#L201

        self.state = "DELETED"

or

https://github.com/openstack/watcher/blob/master/watcher/tests/db/test_audit.py#L274

        audit2 = self._create_test_audit(
            id=2,
            audit_type='CONTINUOUS',
            uuid=w_utils.generate_uuid(),
            deadline=None,
            state='PENDING')

String value should be replace by Enum related one.

in our previous example, we should have:

        self.state = State.DELETED
or

        audit2 = self._create_test_audit(
            id=2,
            audit_type=objects.audit.AuditType.CONTINUOUS.value,
            uuid=w_utils.generate_uuid(),
            deadline=None,
            state=objects.audit.State.PENDING)

Atul Pandey (atul-4you)
Changed in watcher:
assignee: nobody → Atul Pandey (atul-4you)
Revision history for this message
Atul Pandey (atul-4you) wrote :

Submitted the review Patch : https://review.openstack.org/#/c/390440/

Changed in watcher:
status: Confirmed → In Progress
Revision history for this message
Atul Pandey (atul-4you) wrote :
Changed in watcher:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.