def test_validate_port_range_err(self): """Test the add source command with port validation out of range.""" source_out = StringIO() with self.assertRaises(ArgumentTypeError): with redirect_stdout(source_out): validate_port('65537') self.assertTrue('Port value 65537' in source_out.getvalue())
def test_validate_port_bad_type(self): """Testing the add source command with port validation bad type.""" source_out = StringIO() with self.assertRaises(ArgumentTypeError): with redirect_stdout(source_out): validate_port(['ff']) self.assertTrue('Port value ff' in source_out.getvalue())
def test_validate_port_good(self): """Testing the add source command with port validation success.""" val = validate_port('80') self.assertEqual(80, val)