def test_with_env_with_path(self): co.register_context(env=env_detector, role=None, node=None) ls = co.get_filenames(self.example_a_path) self.assertListEqual( [self.example_a_path, self.make_example_a_path(env='env_a')], ls) ls = co.get_filenames(self.example_a_path, env='env_b') self.assertEqual([self.example_a_path], ls)
def test_with_node_with_path(self): co.register_context(env=None, role=None, node=node_detector) ls = co.get_filenames(self.example_a_path) self.assertListEqual( [self.example_a_path, self.make_example_a_path(node='node_a')], ls) ls = co.get_filenames(self.example_a_path, node='node_b') self.assertListEqual([self.example_a_path], ls)
def test_with_role_with_fp(self): co.register_context(env=None, role=role_detector, node=None) ls = ConfigParser().read(co.get_filenames(self.example_a_fp)) self.assertListEqual( [self.example_a_path, self.make_example_a_path(role='role_a')], ls) ls = ConfigParser().read( co.get_filenames(self.example_a_fp, role='role_b')) self.assertListEqual([self.example_a_fp.name], ls)
def test_combination_of_node_env_role(self): co.register_context(env=env_detector, role=role_detector, node=node_detector) ls = co.get_filenames(self.example_a_path) self.assertListEqual([ self.example_a_path, self.make_example_a_path(env='env_a'), self.make_example_a_path(role='role_a'), self.make_example_a_path(node='node_a'), ], ls)
def test_multiple_files(self): co.register_context(env=env_detector, role=role_detector, node=node_detector) ls = co.get_filenames([self.example_a_path, self.example_b_path]) self.assertListEqual([ self.example_a_path, self.make_example_a_path(env='env_a'), self.make_example_a_path(role='role_a'), self.make_example_a_path(node='node_a'), self.example_b_path, ], ls)
def test_no_context_with_path(self): co.register_context(env=None, role=None, node=None) ls = ConfigParser().read(co.get_filenames(self.example_a_path)) self.assertEqual(1, len(ls))
def setUp(self): co.register_context(env=None, role=None, node=None)