# License for the specific language governing permissions and limitations # under the License. # """ Misc commands tester """ import agent_test import agentlib class TestMiscCommands(agent_test.TestCase): def test_features(self): """Test the 'features' command""" resp = self.commands.run_command('features', 'agent') expected = (0, ','.join(self.commands.command_names())) self.assertEqual(resp, expected) def test_version(self): """Test the 'version' command""" resp = self.commands.run_command('version', 'agent') expected = (0, agentlib.get_version()) self.assertEqual(resp, expected) if __name__ == "__main__": agent_test.main()
self.assertSequenceEqual(generated, expected) def test_suse_ipv6(self): """Test setting public IPv6 for SuSE networking""" interface = { 'label': 'public', 'hwaddr': '00:11:22:33:44:55', 'ipv6': [('2001:db8::42', 96)], 'gateway6': '2001:db8::1', 'dns': ['2001:db8::2'], } outfiles = self._run_test('suse', eth0=interface) self.assertTrue('ifcfg-eth0' in outfiles) generated = outfiles['ifcfg-eth0'].rstrip().rstrip().split('\n') expected = [ "# Automatically generated, do not edit", "", "# Label public", "BOOTPROTO='static'", "IPADDR='2001:db8::42'", "PREFIXLEN='96'", "STARTMODE='auto'", "USERCONTROL='no'", ] self.assertSequenceEqual(generated, expected) if __name__ == "__main__": agent_test.main()