def test_config3(self): writer = Writer(self.data, content='') writer.get_config([None],3) num_files = len([name for name in os.listdir('.')]) self.assertEquals(num_files, 1) config = os.listdir('.')[0] self.assertEqual(config, 'cloud-config-3.xml')
def test_config2(self): writer = Writer(self.data, content='') writer.get_config(['a16e0bb', '5fa34fc', '01bc2b2', '4a5af86', '5030820', '54af3bd', '8b83879'],1) num_files = len([name for name in os.listdir('.')]) self.assertEquals(num_files, 1) config = os.listdir('.')[0] self.assertEqual(config, 'cloud-config-1.xml') tree = ET.parse(config) testTree = ET.parse(self.data['CL-params']['-f']) self.assertNotEqual(tree, testTree) root = tree.getroot() dir = root.find('.//project').attrib['dir'] self.assertEqual(expanduser(dir), '/home/selin/tmp/project/protostuff') jmh = root.find('.//project/jmh_root').attrib['dir'] self.assertEqual(expanduser(jmh), '/home/selin/tmp/project/benchmarks') v1 = root.find('.//project/versions/start').text v2 = root.find('.//project/versions/end').text self.assertIn(v1, 'a16e0bb') self.assertIn(v2, '8b83879')
def test_config(self): writer = Writer(self.data, content='') writer.get_config([None],1) num_files = len([name for name in os.listdir('.')]) self.assertEquals(num_files, 1) config = os.listdir('.')[0] self.assertEqual(config, 'cloud-config-1.xml') tree = ET.parse(config) testTree = ET.parse(self.data['CL-params']['-f']) self.assertNotEqual(tree, testTree) root = tree.getroot() dir = root.find('.//project').attrib['dir'] self.assertEqual(expanduser(dir), '/home/selin/tmp/project/protostuff') jmh = root.find('.//project/jmh_root').attrib['dir'] self.assertEqual(expanduser(jmh), '/home/selin/tmp/project/benchmarks') v1 = root.find('.//project/versions/start').text v2 = root.find('.//project/versions/end').text self.assertIn(v1, '8924a5f') self.assertIn(v2, '4c2ec16') self.assertEqual(self.data['CL-params']['-f'],"/home/selin/Documents/Uni/Bachelorthesis/Testing/test-conf.xml")