コード例 #1
0
 def test_component7(self):
     error, args, config = deploy.parse_args(["-c", "test_data/test_config.ini", "-u", "bob", "-p", "mypass", "all"])
     error, files, dirs = deploy.create_file_list(config, "component7", set())
     self.assertEqual("Directory './non-existant/' not found (or is not a directory).",
                      error)
     self.assertIsNone(files)
     self.assertIsNone(dirs)
コード例 #2
0
 def test_component4(self):
     error, args, config = deploy.parse_args(["-c", "test_data/test_config.ini", "-u", "bob", "-p", "mypass", "all"])
     error, files, dirs = deploy.create_file_list(config, "component4", set())
     self.assertEqual(
         "Could not find file starting with 'file' and ending with 'json' in path './test_data/'. Skipping deployment target 'component4'.",
         error)
     self.assertIsNone(files)
     self.assertIsNone(dirs)
コード例 #3
0
 def test_group3(self):
     error, args, config = deploy.parse_args(["-c", "test_data/test_config.ini", "-u", "bob", "-p", "mypass", "all"])
     error, files, dirs = deploy.create_file_list(config, "group3", set())
     self.assertEqual("Key '' not found in configuration.",
                      error)
     dst_ip = "www.kanstren.net"
     src_dir = './test_data/'
     dst_dir = '/home/randomguy/testtarget/component1/'
     self.assertIsNone(files)
     self.assertEqual(0, len(dirs))
コード例 #4
0
 def test_component5(self):
     error, args, config = deploy.parse_args(["-c", "test_data/test_config.ini", "-u", "bob", "-p", "mypass", "all"])
     error, files, dirs = deploy.create_file_list(config, "component5", set())
     self.assertIsNone(error)
     self.assertEqual(0, len(dirs))
     dst_ip = "192.168.56.101"
     src_dir = './test_data/'
     dst_dir = '/home/randomguy/testtarget/component1'
     self.assertEqual(2, len(files))
     self.assertEqual(src_dir + "file1.txt", files[0].src_path)
     self.assertEqual(dst_dir, files[0].dst_path)
     self.assertEqual(dst_ip, files[0].dst_ip)
     self.assertEqual(src_dir + "hello.xml", files[1].src_path)
     self.assertEqual(dst_dir, files[1].dst_path)
     self.assertEqual(dst_ip, files[1].dst_ip)
コード例 #5
0
 def test_group1(self):
     error, args, config = deploy.parse_args(["-c", "test_data/test_config.ini", "-u", "bob", "-p", "mypass", "all"])
     error, files, dirs = deploy.create_file_list(config, "group1", set())
     self.assertEqual("Could not find file starting with 'test_file_1' and ending with '.txt' in path './test_data'. Skipping deployment target 'component1'.", error)
     dst_ip = "192.168.56.101"
     src_dir = './test_data/'
     dst_dir = '/home/randomguy/testtarget/component1'
     self.assertEqual(2, len(files))
     self.assertEqual(0, len(dirs))
     self.assertEqual(src_dir + "file1.txt", files[0].src_path)
     self.assertEqual(dst_dir, files[0].dst_path)
     self.assertEqual(dst_ip, files[0].dst_ip)
     self.assertEqual(src_dir + "hello.xml", files[1].src_path)
     self.assertEqual(dst_dir, files[1].dst_path)
     self.assertEqual(dst_ip, files[1].dst_ip)
コード例 #6
0
 def test_component2(self):
     error, args, config = deploy.parse_args(["-c", "test_data/test_config.ini", "-u", "bob", "-p", "mypass", "all"])
     error, files, dirs = deploy.create_file_list(config, "component2", set())
     self.assertIsNone(error)
     dst_ip = "192.168.56.101"
     src_dir = './test_data/'
     dst_dir = '/home/randomguy/testtarget'
     self.assertEqual(0, len(files))
     self.assertEqual(2, len(dirs))
     self.assertEqual(src_dir, dirs[0].src_path)
     self.assertEqual(dst_dir, dirs[0].dst_path)
     self.assertEqual(dst_ip, dirs[0].dst_ip)
     self.assertEqual(22, dirs[0].dst_port)
     self.assertEqual(src_dir, dirs[1].src_path)
     self.assertEqual(dst_dir, dirs[1].dst_path)
     self.assertEqual("service1.target.example", dirs[1].dst_ip)
     self.assertEqual(22, dirs[1].dst_port)
コード例 #7
0
 def test_component6(self):
     error, args, config = deploy.parse_args(["-c", "test_data/test_config.ini", "-u", "bob", "-p", "mypass", "all"])
     error, files, dirs = deploy.create_file_list(config, "component6", set())
     self.assertEqual("Target 'component6' specifies both pre/postfix and 'file_names'. Remove one. Skipping target.",
                      error)
     self.assertIsNone(files)