Merge "Remove unicode from tests"

This commit is contained in:
Zuul 2020-12-23 08:10:37 +00:00 committed by Gerrit Code Review
commit 9ab0c623ba
5 changed files with 61 additions and 61 deletions

View File

@ -16,13 +16,13 @@
from vitrage.tests.functional import api
VERSIONS_RESPONSE = {u'versions': [{u'id': u'v1.0',
u'links': [
{u'href': u'http://localhost/v1/',
u'rel': u'self'}],
u'status': u'CURRENT',
u'updated': u'2015-11-29'}]}
VERSIONS_RESPONSE = {'versions': [
{'id': 'v1.0',
'links': [
{'href': 'http://localhost/v1/',
'rel': 'self'}],
'status': 'CURRENT',
'updated': '2015-11-29'}]}
class TestVersions(api.FunctionalTest):

View File

@ -21,16 +21,16 @@ from vitrage.tests.functional.api.v1 import FunctionalTest
VERSIONS = [
{
u'version': u'v1',
u'status': u'SUPPORTED'
'version': 'v1',
'status': 'SUPPORTED'
},
{
u'version': u'v2',
u'status': u'SUPPORTED'
'version': 'v2',
'status': 'SUPPORTED'
},
{
u'version': u'v3',
u'status': 'CURRENT'
'version': 'v3',
'status': 'CURRENT'
}
]

View File

@ -29,7 +29,7 @@ class NagiosParserTest(NagiosBaseTest):
NagiosProperties.DURATION: ' 8d 2h 16m 33s',
NagiosProperties.ATTEMPT: '1/1',
NagiosProperties.STATUS_INFO:
u'high CPU load\xa0'}
'high CPU load\xa0'}
expected_service2 = {NagiosProperties.RESOURCE_NAME: 'compute-0-1.local',
NagiosProperties.SERVICE: 'check_load',
@ -38,7 +38,7 @@ class NagiosParserTest(NagiosBaseTest):
NagiosProperties.DURATION: ' 1d 0h 54m 59s',
NagiosProperties.ATTEMPT: '1/1',
NagiosProperties.STATUS_INFO:
u'Critical Error\xa0'}
'Critical Error\xa0'}
expected_service3 = {NagiosProperties.RESOURCE_NAME: 'compute-0-0.local',
NagiosProperties.SERVICE: 'Disk IO SUMMARY',
@ -47,8 +47,8 @@ class NagiosParserTest(NagiosBaseTest):
NagiosProperties.DURATION: '14d 1h 28m 34s',
NagiosProperties.ATTEMPT: '1/1',
NagiosProperties.STATUS_INFO:
u'OK - 0.00 B/sec read, 1.84 MB/sec write, '
u'IOs: 89.00/sec\xa0'}
'OK - 0.00 B/sec read, 1.84 MB/sec write, '
'IOs: 89.00/sec\xa0'}
# noinspection PyPep8Naming
@classmethod

View File

@ -89,7 +89,7 @@ class PrometheusDriverTest(base.BaseTest):
driver._calculate_vitrage_entity_unique_props(host_alert_2)
# Test assertion
expected = {u'id': hostname}
expected = {'id': hostname}
self.assertEqual(expected, observed_host_alert_1)
self.assertEqual(expected, observed_host_alert_2)
@ -113,8 +113,8 @@ class PrometheusDriverTest(base.BaseTest):
driver._calculate_vitrage_entity_unique_props(vm_alert_2)
# Test assertion
expected = {u'instance_name': 'instance-00000005',
u'host_id': hostname}
expected = {'instance_name': 'instance-00000005',
'host_id': hostname}
self.assertEqual(expected, observed_vm_alert_1)
self.assertEqual(expected, observed_vm_alert_2)
@ -131,9 +131,9 @@ class PrometheusDriverTest(base.BaseTest):
observed_alert_2 = driver._get_resource_alert_values(alert_2)
# Test assertions
expected_alert_1 = {u'instance': '135.248.18.109:9100'}
expected_alert_2 = {u'instance': '135.248.18.109:9177',
u'domain': 'instance-00000005'}
expected_alert_1 = {'instance': '135.248.18.109:9100'}
expected_alert_2 = {'instance': '135.248.18.109:9177',
'domain': 'instance-00000005'}
self.assertEqual(expected_alert_1, observed_alert_1)
self.assertEqual(expected_alert_2, observed_alert_2)
@ -150,9 +150,9 @@ class PrometheusDriverTest(base.BaseTest):
observed_alert_2 = driver._get_conf_resource(alert_2)
# Test assertions
expected_alert_1 = {u'id': u'instance'}
expected_alert_2 = {u'instance_name': u'domain',
u'host_id': u'instance'}
expected_alert_1 = {'id': 'instance'}
expected_alert_2 = {'instance_name': 'domain',
'host_id': 'instance'}
self.assertEqual(expected_alert_1, observed_alert_1)
self.assertEqual(expected_alert_2, observed_alert_2)

View File

@ -71,40 +71,40 @@ BINDS_REPORTED = [
]
DICT_EXPECTED = {
u'1.3.6.1.4.1.3902.4101.1.3.1.8':
u'vimid=,hid=controller_controller,'
u'hostname=controller,'
u'Reason: nova-compute is not available',
u'1.3.6.1.4.1.3902.4101.1.3.1.9': 1581,
u'1.3.6.1.4.1.3902.4101.1.3.1.6': 0,
u'1.3.6.1.4.1.3902.4101.1.3.1.7': u'',
u'1.3.6.1.4.1.3902.4101.1.3.1.4': 1,
u'1.3.6.1.4.1.3902.4101.1.3.1.5': 14,
u'1.3.6.1.4.1.3902.4101.1.3.1.2': u'host',
u'1.3.6.1.4.1.3902.4101.1.3.1.3':
u'\x07\xe1\x04\x06\x07\x04\x08\x00+\x08\x00',
u'1.3.6.1.4.1.3902.4101.1.3.1.1': u'3e7393db-2def-447c-8cba-77bf29ab29b4',
u'1.3.6.1.4.1.3902.4101.1.3.1.18': 0,
u'1.3.6.1.4.1.3902.4101.1.3.1.19': u'',
u'1.3.6.1.4.1.3902.4101.1.3.1.10': u'',
u'1.3.6.1.4.1.3902.4101.1.3.1.11': u'3305115653',
u'1.3.6.1.4.1.3902.4101.1.3.1.12': u'Tecs Director',
u'1.3.6.1.4.1.3902.4101.1.3.1.14': u'compute is not available',
u'1.3.6.1.4.1.3902.4101.1.3.1.15': u'vimid=,hostname=controller',
u'1.3.6.1.4.1.3902.4101.1.3.1.16': u'',
u'1.3.6.1.4.1.3902.4101.1.3.1.17': u'10.62.89.92',
u'1.3.6.1.4.1.3902.4101.1.1.4': 0,
u'1.3.6.1.4.1.3902.4101.1.1.3': u'',
u'1.3.6.1.4.1.3902.4101.1.1.2': 0,
u'1.3.6.1.2.1.1.3.0': u'1491462248',
u'1.3.6.1.6.3.1.1.4.1.0': u'1.3.6.1.4.1.3902.4101.1.4.1.2',
u'1.3.6.1.4.1.3902.4101.1.3.1.25': u'',
u'1.3.6.1.4.1.3902.4101.1.3.1.24': u'',
u'1.3.6.1.4.1.3902.4101.1.3.1.26': u'controller_controller',
u'1.3.6.1.4.1.3902.4101.1.3.1.21': 0,
u'1.3.6.1.4.1.3902.4101.1.3.1.20': u'Asia/Harbin',
u'1.3.6.1.4.1.3902.4101.1.3.1.23': u'',
u'1.3.6.1.4.1.3902.4101.1.3.1.22': 0
'1.3.6.1.4.1.3902.4101.1.3.1.8':
'vimid=,hid=controller_controller,'
'hostname=controller,'
'Reason: nova-compute is not available',
'1.3.6.1.4.1.3902.4101.1.3.1.9': 1581,
'1.3.6.1.4.1.3902.4101.1.3.1.6': 0,
'1.3.6.1.4.1.3902.4101.1.3.1.7': '',
'1.3.6.1.4.1.3902.4101.1.3.1.4': 1,
'1.3.6.1.4.1.3902.4101.1.3.1.5': 14,
'1.3.6.1.4.1.3902.4101.1.3.1.2': 'host',
'1.3.6.1.4.1.3902.4101.1.3.1.3':
'\x07\xe1\x04\x06\x07\x04\x08\x00+\x08\x00',
'1.3.6.1.4.1.3902.4101.1.3.1.1': '3e7393db-2def-447c-8cba-77bf29ab29b4',
'1.3.6.1.4.1.3902.4101.1.3.1.18': 0,
'1.3.6.1.4.1.3902.4101.1.3.1.19': '',
'1.3.6.1.4.1.3902.4101.1.3.1.10': '',
'1.3.6.1.4.1.3902.4101.1.3.1.11': '3305115653',
'1.3.6.1.4.1.3902.4101.1.3.1.12': 'Tecs Director',
'1.3.6.1.4.1.3902.4101.1.3.1.14': 'compute is not available',
'1.3.6.1.4.1.3902.4101.1.3.1.15': 'vimid=,hostname=controller',
'1.3.6.1.4.1.3902.4101.1.3.1.16': '',
'1.3.6.1.4.1.3902.4101.1.3.1.17': '10.62.89.92',
'1.3.6.1.4.1.3902.4101.1.1.4': 0,
'1.3.6.1.4.1.3902.4101.1.1.3': '',
'1.3.6.1.4.1.3902.4101.1.1.2': 0,
'1.3.6.1.2.1.1.3.0': '1491462248',
'1.3.6.1.6.3.1.1.4.1.0': '1.3.6.1.4.1.3902.4101.1.4.1.2',
'1.3.6.1.4.1.3902.4101.1.3.1.25': '',
'1.3.6.1.4.1.3902.4101.1.3.1.24': '',
'1.3.6.1.4.1.3902.4101.1.3.1.26': 'controller_controller',
'1.3.6.1.4.1.3902.4101.1.3.1.21': 0,
'1.3.6.1.4.1.3902.4101.1.3.1.20': 'Asia/Harbin',
'1.3.6.1.4.1.3902.4101.1.3.1.23': '',
'1.3.6.1.4.1.3902.4101.1.3.1.22': 0
}
@ -129,7 +129,7 @@ class TestSnmpParsing(base.BaseTest):
def test_converted_trap_mapping_diff_system(self):
converted_trap_diff_sys = copy.copy(DICT_EXPECTED)
converted_trap_diff_sys.update(
{u'1.3.6.1.4.1.3902.4101.1.3.1.12': u'Different System'})
{'1.3.6.1.4.1.3902.4101.1.3.1.12': 'Different System'})
parsing_service = SnmpParsingService(1)
event_type = parsing_service._get_event_type(converted_trap_diff_sys)
self.assertIsNone(event_type)