本文整理匯總了Python中hap2_ceilometer.Common類的典型用法代碼示例。如果您正苦於以下問題:Python Common類的具體用法?Python Common怎麽用?Python Common使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Common類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
def __init__(self, options={}):
Common.__init__(self)
self.__options = options
self.store = {}
# replace a lower layer method
self._Common__request = self.__request
示例2: test_parse_time_without_micro
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)
示例3: __assert
def __assert(self, status, expect):
self.assertEquals(Common.status_to_hapi_event_type(status), expect)
示例4: test_alarm_to_hapi_status_creation
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")
示例5: test_alarm_to_hapi_status_unknown
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")
示例6: test_alarm_to_hapi_status_ng
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")
示例7: test_hapi_time_to_url_enc_openstack_time_with_dot_only
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)
示例8: test_hapi_time_to_url_enc_openstack_time_with_ns
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)