Skip to content

Commit 2e6a123

Browse files
committed
Adds SNMP functional test python3 support
Problem: This functional test did not support python3. Analysis: This patch adds python3 support
1 parent b78859e commit 2e6a123

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

test/functional/tm/sys/test_snmp.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@
1414
#
1515

1616
import copy
17+
import pytest
18+
1719
from distutils.version import LooseVersion
1820
from icontrol.session import iControlUnexpectedHTTPError
19-
import pytest
21+
from six import iteritems
2022

2123
VERSIONS = [1, '1', '2c']
2224
VERSIONS_AUTH = [3, '3']
@@ -384,7 +386,7 @@ def test_community_modify(self, request, mgmt_root, setup_device_snapshot):
384386
original_dict = copy.copy(comm1.__dict__)
385387
commName = 'communityName'
386388
comm1.modify(communityName='footest1')
387-
for k, v in original_dict.items():
389+
for k, v in iteritems(original_dict):
388390
if k != commName:
389391
original_dict[k] = comm1.__dict__[k]
390392
elif k == commName:
@@ -453,7 +455,7 @@ def test_user_modify(self, request, mgmt_root, setup_device_snapshot):
453455
original_dict = copy.copy(user1.__dict__)
454456
accessName = 'access'
455457
user1.modify(access='rw')
456-
for k, v in original_dict.items():
458+
for k, v in iteritems(original_dict):
457459
if k != accessName:
458460
original_dict[k] = user1.__dict__[k]
459461
elif k == accessName:
@@ -519,7 +521,7 @@ def test_trap_create_bad_version(
519521
port=1234,
520522
version=badVal
521523
)
522-
assert 'expected one of the following' in err.value.message
524+
assert 'expected one of the following' in str(err.value)
523525

524526
def test_trap_create_bad_port(
525527
self, request, mgmt_root, setup_device_snapshot
@@ -547,7 +549,7 @@ def test_trap_create_bad_port(
547549
port=badVal,
548550
version=version
549551
)
550-
assert 'invalid or ambiguous service' in err.value.message
552+
assert 'invalid or ambiguous service' in str(err.value)
551553

552554
def test_trap_create_named_port(
553555
self, request, mgmt_root, setup_device_snapshot
@@ -617,7 +619,7 @@ def test_trap_modify(self, request, mgmt_root, setup_device_snapshot):
617619
original_dict = copy.copy(trap1.__dict__)
618620
host = 'host'
619621
trap1.modify(host='20.20.20.20')
620-
for k, v in original_dict.items():
622+
for k, v in iteritems(original_dict):
621623
if k != host:
622624
original_dict[k] = trap1.__dict__[k]
623625
elif k == host:

0 commit comments

Comments
 (0)