#10 - Creating auxiliary client class to generate configuration class (#78)

* #10 - Creating auxiliary client class to generate configuration class based on cachet's component list.

* Updating the python version in codacy to reduce false positives

* Moving some of the cachet operations to the client class to clean up the configuration class and making better constants

* Refactoring status to have proper classes and adding more tests. Refactoring the requests tests to use requests-mock.

* Removing unused imports from test_scheduler

* Adding more tests and the ability to run the client from command line

* Updating README and client arg parsing

* Fixing broken unit tests
This commit is contained in:
mtakaki
2020-01-18 13:55:07 -08:00
committed by GitHub
parent bcafbd64f7
commit 5be0217c00
13 changed files with 530 additions and 269 deletions

View File

@@ -3,22 +3,30 @@
This file defines all the different status different values.
These are all constants and are coupled to cachet's API configuration.
"""
from enum import Enum
COMPONENT_STATUS_OPERATIONAL = 1
COMPONENT_STATUS_PERFORMANCE_ISSUES = 2
COMPONENT_STATUS_PARTIAL_OUTAGE = 3
COMPONENT_STATUS_MAJOR_OUTAGE = 4
COMPONENT_STATUSES = [COMPONENT_STATUS_OPERATIONAL,
COMPONENT_STATUS_PERFORMANCE_ISSUES, COMPONENT_STATUS_PARTIAL_OUTAGE,
COMPONENT_STATUS_MAJOR_OUTAGE]
class ComponentStatus(Enum):
OPERATIONAL = 1
PERFORMANCE_ISSUES = 2
PARTIAL_OUTAGE = 3
MAJOR_OUTAGE = 4
INCIDENT_PARTIAL = 'PARTIAL'
INCIDENT_MAJOR = 'MAJOR'
INCIDENT_PERFORMANCE = 'PERFORMANCE'
INCIDENT_MAP = {
INCIDENT_PARTIAL: COMPONENT_STATUS_PARTIAL_OUTAGE,
INCIDENT_MAJOR: COMPONENT_STATUS_MAJOR_OUTAGE,
INCIDENT_PERFORMANCE: COMPONENT_STATUS_PERFORMANCE_ISSUES,
INCIDENT_PARTIAL: ComponentStatus.PARTIAL_OUTAGE,
INCIDENT_MAJOR: ComponentStatus.MAJOR_OUTAGE,
INCIDENT_PERFORMANCE: ComponentStatus.PERFORMANCE_ISSUES,
}
class IncidentStatus(Enum):
SCHEDULED = 0
INVESTIGATING = 1
IDENTIFIED = 2
WATCHING = 3
FIXED = 4