Skip to content

Commit

Permalink
Merge pull request #129 from rundeck-plugins/fix-test-parse-port
Browse files Browse the repository at this point in the history
fix tests
  • Loading branch information
ltamaster authored Mar 28, 2022
2 parents 85bcc07 + c08ec6d commit 7824480
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions contents/tests/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ def test_parse_ports(self):
intended to prevent regressions, not to suggest there is a fundamental
problem with naming a single port.
"""
entry = {'node_port': 90, 'port': 8080, 'protocol': 'http', 'targetPort': 80}
named_entry = {'name': 'foo', 'node_port': 90, 'port': 8080, 'protocol': 'http', "targetPort": 80}
entry = {'node_port': 90, 'port': 8080, 'protocol': 'TCP', 'targetPort': 80}
named_entry = {'name': 'foo', 'node_port': 90, 'port': 8080, 'protocol': 'TCP', "targetPort": 80}

data = json.dumps(entry)
actual = common.parsePorts(data)
Expand All @@ -31,13 +31,17 @@ def test_parse_ports(self):

data = json.dumps(named_entry)
actual = common.parsePorts(data)
print(actual)
port = actual.pop()
print(port)
self.assert_port_match(port, named_entry, None)

data = json.dumps([named_entry, entry])
print(data)
actual = common.parsePorts(data)
port = actual.pop()
self.assert_port_match(port, entry, entry['protocol'] + str(entry['port']))
print(port)
self.assert_port_match(port, entry, str.lower(entry['protocol']) + str(entry['port']))
port = actual.pop()
self.assert_port_match(port, entry, named_entry['name'])

Expand Down

0 comments on commit 7824480

Please # to comment.