예제 #1
0
    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)
예제 #2
0
    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)
예제 #3
0
    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)
예제 #4
0
    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)
예제 #5
0
    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)
예제 #6
0
 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))
예제 #7
0
 def setUp(self):
     co.register_context(env=None, role=None, node=None)