def test_can_get_a_path_to_a_config_file(self):
        config = generate_config_for_component(Components.HELLO_WORLD_JS)

        config_file = generate_config_file(config)

        path = get_path_to_config_file(config_file)

        self.assertEqual(config_file.generate_path_to_file(), path)

        self.assertTrue(os.path.exists(path))

        with open(path, 'r') as output_file:
            content = output_file.read()

        self.assertEqual(content, config_file.render())
Пример #2
0
    def test_can_get_a_path_to_a_config_file(self):
        config = generate_config_for_component(Components.HELLO_WORLD_JS)

        config_file = generate_config_file(config)

        path = get_path_to_config_file(config_file)

        self.assertEqual(config_file.generate_path_to_file(), path)

        self.assertTrue(os.path.exists(path))

        with open(path, 'r') as output_file:
            content = output_file.read()

        self.assertEqual(content, config_file.render())
    def test_can_generate_and_create_a_config_file(self):
        config = generate_config_for_component(Components.HELLO_WORLD_JS)

        config_file = generate_config_file(config)
        self.assertIsInstance(config_file, ConfigFile)

        self.assertIsInstance(config_file.content[0], JS)
        self.assertEqual(config_file.content[0].content, 'var path = require("path");\n')

        self.assertIsInstance(config_file.content[1], JS)
        self.assertEqual(config_file.content[1].content, 'module.exports = ')

        self.assertEqual(config_file.content[2], config)
        self.validate_generated_config(config_file.content[2], Components.HELLO_WORLD_JS)

        self.assertIsInstance(config_file.content[3], JS)
        self.assertEqual(config_file.content[3].content, ';')
Пример #4
0
    def test_can_generate_and_create_a_config_file(self):
        config = generate_config_for_component(Components.HELLO_WORLD_JS)

        config_file = generate_config_file(config)
        self.assertIsInstance(config_file, ConfigFile)

        self.assertIsInstance(config_file.content[0], JS)
        self.assertEqual(config_file.content[0].content,
                         'var path = require("path");\n')

        self.assertIsInstance(config_file.content[1], JS)
        self.assertEqual(config_file.content[1].content, 'module.exports = ')

        self.assertEqual(config_file.content[2], config)
        self.validate_generated_config(config_file.content[2],
                                       Components.HELLO_WORLD_JS)

        self.assertIsInstance(config_file.content[3], JS)
        self.assertEqual(config_file.content[3].content, ';')