Skip to content

Commit 3661081

Browse files
committed
Add test cases to leave off port
1 parent eec89fc commit 3661081

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

test/test/host_test_default.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,30 @@ def test_os_info(self):
2525
"grm_host" : "10.2.123.43",
2626
"grm_port" : "3334",
2727
}
28+
29+
# Case that includes an IP address but no protocol
2830
arg = [expected["grm_module"], expected["grm_host"], expected["grm_port"]]
2931
result = DefaultTestSelector._parse_grm(":".join(arg))
3032
self.assertEqual(result, expected)
3133

34+
# Case that includes an IP address but no protocol nor a no port
35+
expected["grm_port"] = None
36+
arg = [expected["grm_module"], expected["grm_host"]]
37+
result = DefaultTestSelector._parse_grm(":".join(arg))
38+
self.assertEqual(result, expected)
39+
40+
# Case that includes an IP address and a protocol
3241
expected["grm_host"] = "https://10.2.123.43"
42+
expected["grm_port"] = "443"
3343
arg = [expected["grm_module"], expected["grm_host"], expected["grm_port"]]
3444
result = DefaultTestSelector._parse_grm(":".join(arg))
3545
self.assertEqual(result, expected)
3646

47+
# Case that includes an IP address and a protocol, but no port
48+
expected["grm_port"] = None
49+
arg = [expected["grm_module"], expected["grm_host"]]
50+
result = DefaultTestSelector._parse_grm(":".join(arg))
51+
self.assertEqual(result, expected)
52+
3753
if __name__ == '__main__':
3854
unittest.main()

test/test/mbed_gt_test_api.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,9 +604,17 @@ def test_parse_global_resource_mgr(self):
604604
result = mbed_test_api.parse_global_resource_mgr(":".join(expected))
605605
self.assertEqual(result, expected)
606606

607+
expected = ("K64F", "module_name", "10.2.123.43", None)
608+
result = mbed_test_api.parse_global_resource_mgr(":".join(expected[:3]))
609+
self.assertEqual(result, expected)
610+
607611
expected = ("K64F", "module_name", "https://10.2.123.43", "3334")
608612
result = mbed_test_api.parse_global_resource_mgr(":".join(expected))
609613
self.assertEqual(result, expected)
610614

615+
expected = ("K64F", "module_name", "https://10.2.123.43", None)
616+
result = mbed_test_api.parse_global_resource_mgr(":".join(expected[:3]))
617+
self.assertEqual(result, expected)
618+
611619
if __name__ == '__main__':
612620
unittest.main()

0 commit comments

Comments
 (0)