Example #1
0
    def __init__(self, options={}):
        Common.__init__(self)
        self.__options = options
        self.store = {}

        # replace a lower layer method
        self._Common__request = self.__request
Example #2
0
    def __init__(self, options={}):
        Common.__init__(self)
        self.__options = options
        self.store = {}

        # replace a lower layer method
        self._Common__request = self.__request
Example #3
0
 def test_parse_time_without_micro(self):
     actual = Common.parse_time("2014-09-05T06:25:29")
     expect = datetime(2014, 9, 5, 6, 25, 29)
     self.assertEqual(actual, expect)
Example #4
0
 def __assert(self, status, expect):
     self.assertEquals(Common.status_to_hapi_event_type(status), expect)
Example #5
0
 def test_alarm_to_hapi_status_creation(self):
     alarm_type = "creation"
     detail = '{"state": "ok"}'
     evt_type = Common.alarm_to_hapi_status(alarm_type, detail)
     self.assertEqual(evt_type, "OK")
Example #6
0
 def test_alarm_to_hapi_status_unknown(self):
     alarm_type = "state transition"
     detail = '{"state": "insufficient data"}'
     evt_type = Common.alarm_to_hapi_status(alarm_type, detail)
     self.assertEqual(evt_type, "UNKNOWN")
Example #7
0
 def test_alarm_to_hapi_status_ng(self):
     alarm_type = "state transition"
     detail = '{"state": "alarm"}'
     evt_type = Common.alarm_to_hapi_status(alarm_type, detail)
     self.assertEqual(evt_type, "NG")
Example #8
0
 def test_hapi_time_to_url_enc_openstack_time_with_dot_only(self):
     hapi_time = "20150624081005."
     actual = Common.hapi_time_to_url_enc_openstack_time(hapi_time)
     expect = "2015-06-24T08%3A10%3A05.000000"
     self.assertEqual(actual, expect)
Example #9
0
 def test_hapi_time_to_url_enc_openstack_time_with_ns(self):
     hapi_time = "20150624081005.123456789"
     actual = Common.hapi_time_to_url_enc_openstack_time(hapi_time)
     expect = "2015-06-24T08%3A10%3A05.123456"
     self.assertEqual(actual, expect)
Example #10
0
 def test_parse_time_without_micro(self):
     actual = Common.parse_time("2014-09-05T06:25:29")
     expect = datetime(2014, 9, 5, 6, 25, 29)
     self.assertEqual(actual, expect)
Example #11
0
 def __assert(self, status, expect):
     self.assertEquals(Common.status_to_hapi_event_type(status), expect)
Example #12
0
 def test_alarm_to_hapi_status_creation(self):
     alarm_type = "creation"
     detail = '{"state": "ok"}'
     evt_type = Common.alarm_to_hapi_status(alarm_type, detail)
     self.assertEqual(evt_type, "OK")
Example #13
0
 def test_alarm_to_hapi_status_unknown(self):
     alarm_type = "state transition"
     detail = '{"state": "insufficient data"}'
     evt_type = Common.alarm_to_hapi_status(alarm_type, detail)
     self.assertEqual(evt_type, "UNKNOWN")
Example #14
0
 def test_alarm_to_hapi_status_ng(self):
     alarm_type = "state transition"
     detail = '{"state": "alarm"}'
     evt_type = Common.alarm_to_hapi_status(alarm_type, detail)
     self.assertEqual(evt_type, "NG")
Example #15
0
 def test_hapi_time_to_url_enc_openstack_time_with_dot_only(self):
     hapi_time = "20150624081005."
     actual = Common.hapi_time_to_url_enc_openstack_time(hapi_time)
     expect = "2015-06-24T08%3A10%3A05.000000"
     self.assertEqual(actual, expect)
Example #16
0
 def test_hapi_time_to_url_enc_openstack_time_with_ns(self):
     hapi_time = "20150624081005.123456789"
     actual = Common.hapi_time_to_url_enc_openstack_time(hapi_time)
     expect = "2015-06-24T08%3A10%3A05.123456"
     self.assertEqual(actual, expect)