コード例 #1
0
 def test_prepare_metadata(self):
     """Test we can generate the metadata."""
     temp_path = temp_dir()
     iface = QgisInterface(None)
     builder = PluginBuilder(iface)
     builder.plugin_path = temp_path
     builder._prepare_results_html(self.specification)
コード例 #2
0
 def test_prepare_readme(self):
     """Test we can generate the readme ok."""
     temp_path = temp_dir()
     iface = QgisInterface(None)
     builder = PluginBuilder(iface)
     builder.plugin_path = temp_path
     builder._prepare_readme(self.specification, 'fake_module')
コード例 #3
0
 def test_prepare_code(self):
     """Test the prepare code helper works."""
     temp_path = temp_dir()
     iface = QgisInterface(None)
     builder = PluginBuilder(iface)
     builder.plugin_path = temp_path
     builder._prepare_code(self.specification, temp_path)
コード例 #4
0
 def test_prepare_results_html(self):
     """Test the prepare results helper works."""
     temp_path = temp_dir()
     iface = QgisInterface(None)
     builder = PluginBuilder(iface)
     builder.plugin_path = temp_path
     results_popped, template_module_name = builder._prepare_results_html(
         self.specification)
     self.assertIn('You just built a plugin for QGIS!', results_popped)
     self.assertEquals(template_module_name, 'fake_module')
コード例 #5
0
    def test_dir_copy(self):
        """Test that we can copy a directory of files.

        Path to copy to must not pre-exist so we create a parent dir
        and generate a temp dir name without actually creating it.
        """

        temp_path = temp_dir()
        temp_name = unique_filename(prefix='plugin_builder_')
        new_path = os.path.join(temp_path, temp_name)
        copy(os.path.join(self.templates_path, 'test'), new_path)
        test_file_path = os.path.join(new_path, 'test_init.py')
        self.assertTrue(os.path.exists(test_file_path), test_file_path)