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

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

        # replace a lower layer method
        self._Common__request = self.__request
Esempio n. 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)
Esempio n. 4
0
 def __assert(self, status, expect):
     self.assertEquals(Common.status_to_hapi_event_type(status), expect)
Esempio n. 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")
Esempio n. 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")
Esempio n. 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")
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 11
0
 def __assert(self, status, expect):
     self.assertEquals(Common.status_to_hapi_event_type(status), expect)
Esempio n. 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")
Esempio n. 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")
Esempio n. 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")
Esempio n. 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)
Esempio n. 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)