diff options
| author | Raul Benencia <raul@thousandeyes.com> | 2023-01-04 12:16:59 -0800 |
|---|---|---|
| committer | Raul Benencia <raul@thousandeyes.com> | 2023-01-04 12:18:52 -0800 |
| commit | 5df23c99d98ba5515f882a050cc1986c7d75bca0 (patch) | |
| tree | 92bb6b411287e76efbc766ef557158c15abaf6b1 /test | |
| parent | 3233a856af770c5f928ce9c2329072432feab0f3 (diff) | |
test: ensures compatibility with Python 3
Resolves: #17
Diffstat (limited to 'test')
| -rwxr-xr-x | test/integ-test/integ_test.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/test/integ-test/integ_test.py b/test/integ-test/integ_test.py index 8cc1761..d830e6b 100755 --- a/test/integ-test/integ_test.py +++ b/test/integ-test/integ_test.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2018 ThousandEyes Inc. # @@ -59,7 +59,7 @@ def config_file(shoelaces_binary): sys.stderr.write("Using:\n{}".format(temp_config)) temp_cfg_file = tempfile.NamedTemporaryFile(delete=False) - temp_cfg_file.write(temp_config) + temp_cfg_file.write(bytes(temp_config, 'ascii')) temp_cfg_file.flush() temp_cfg_file_name = temp_cfg_file.name temp_cfg_file.close() @@ -126,10 +126,13 @@ def gen_mac_server_pairs(): @pytest.mark.parametrize(("mac_last_octet", "servers"), gen_mac_server_pairs()) def test_servers(shoelaces_instance, mac_last_octet, servers): + def sort_by_mac(srv): + return srv['Mac'] + poll_url = "{}/poll/1/ff-ff-ff-ff-ff-{}".format(API_URL, mac_last_octet) req = requests.get(poll_url) req = requests.get("{}/ajax/servers".format(API_URL)) - assert sorted(req.json()) == sorted(servers) + assert sorted(req.json(), key=sort_by_mac) == sorted(servers, key=sort_by_mac) def test_unknown_server(shoelaces_instance): |
