def test_creates_requirements(self, os): rpath = 'opal-testplugin/requirements.txt' requirements = self.path/rpath scaffold.start_plugin(self.args, self.path) self.assertTrue(bool(requirements)) with open(requirements) as r: contents = r.read() self.assertIn('opal=={}'.format(opal.__version__), contents)
def test_creates_requirements(self, os): rpath = 'opal-testplugin/requirements.txt' requirements = self.path / rpath scaffold.start_plugin(self.args, self.path) self.assertTrue(bool(requirements)) with open(requirements) as r: contents = r.read() self.assertIn('opal=={}'.format(opal.__version__), contents)
def test_creates_manifest(self, os): rpath = 'opal-testplugin/MANIFEST.in' manifest = self.path/rpath scaffold.start_plugin(self.args, self.path) self.assertTrue(bool(manifest)) with open(manifest) as m: contents = m.read() self.assertIn("recursive-include testplugin/static *", contents) self.assertIn("recursive-include testplugin/templates *", contents)
def test_creates_manifest(self, os): rpath = 'opal-testplugin/MANIFEST.in' manifest = self.path / rpath scaffold.start_plugin(self.args, self.path) self.assertTrue(bool(manifest)) with open(manifest) as m: contents = m.read() self.assertIn("recursive-include testplugin/static *", contents) self.assertIn("recursive-include testplugin/templates *", contents)
def startplugin(args): """ The steps to create our plugin are: * Copy across the scaffold to our plugin directory * Interpolate our name into the appropriate places. * Rename the code dir * Create template/static directories """ scaffold_utils.start_plugin(args.name, USERLAND_HERE) return
def test_creates_appropriate_directory_with_opal_prefix(self, os): test_plugin = self.path / 'opal-testplugin/testplugin' scaffold.start_plugin("opal-testplugin", self.path) self.assertTrue(test_plugin.is_dir)
def test_tree_copied(self, shutil, os): scaffold.start_plugin(self.args, self.path) self.assertTrue(shutil.called)
def test_creates_the_app_directory(self, os): test_plugin = self.path / 'opal-testplugin/testplugin' scaffold.start_plugin(self.args, self.path) self.assertTrue(test_plugin.is_dir)
def test_tree_copied(self, cp_r, subpr): scaffold.start_plugin(self.args, self.path) self.assertTrue(cp_r.called)
def test_calls_interpolate_dir(self, os): with patch.object(scaffold, 'interpolate_dir') as interpolate: scaffold.start_plugin(self.args, self.path) self.assertEqual(interpolate.call_args[1]["name"], "testplugin") self.assertIn("version", interpolate.call_args[1])
def test_creates_css_directory(self, os): css_dir = self.path / 'opal-testplugin/testplugin/static/css' scaffold.start_plugin(self.args, self.path) self.assertTrue(css_dir.is_dir)
def test_creates_services_directory(self, os): rpath = 'opal-testplugin/testplugin/static/js/testplugin/services' services_dir = self.path / rpath scaffold.start_plugin(self.args, self.path) self.assertTrue(services_dir.is_dir)
def test_initialize_git(self, os): scaffold.start_plugin(self.args, self.path) os.assert_any_call('cd opal-testplugin; git init')
def test_creates_the_app_directory(self, os): test_plugin = self.path/'opal-testplugin/testplugin' scaffold.start_plugin(self.args, self.path) self.assertTrue(test_plugin.is_dir)
def test_has_lookuplists_dir(self, os): rpath = 'opal-testplugin/testplugin/data/lookuplists/' lookuplists = self.path/rpath scaffold.start_plugin(self.args, self.path) self.assertTrue(bool(lookuplists))
def test_creates_appropriate_directory_with_opal_prefix(self, os): test_plugin = self.path/'opal-testplugin/testplugin' scaffold.start_plugin("opal-testplugin", self.path) self.assertTrue(test_plugin.is_dir)
def test_creates_services_directory(self, os): rpath = 'opal-testplugin/testplugin/static/js/testplugin/services' services_dir = self.path/rpath scaffold.start_plugin(self.args, self.path) self.assertTrue(services_dir.is_dir)
def test_creates_controllers_directory(self, os): rpath = 'opal-testplugin/testplugin/static/js/testplugin/controllers' controllers_dir = self.path/rpath scaffold.start_plugin(self.args, self.path) self.assertTrue(controllers_dir.is_dir)
def test_creates_css_directory(self, os): css_dir = self.path/'opal-testplugin/testplugin/static/css' scaffold.start_plugin(self.args, self.path) self.assertTrue(css_dir.is_dir)
def test_creates_template_directory(self, os): template_dir = self.path / 'opal-testplugin/testplugin/templates' scaffold.start_plugin(self.args, self.path) self.assertTrue(template_dir.is_dir)
def test_initialize_git(self, subpr): scaffold.start_plugin(self.args, self.path) subpr.assert_any_call(('git', 'init'), cwd=self.path/'opal-testplugin', stdout=subprocess.PIPE)
def test_creates_controllers_directory(self, os): rpath = 'opal-testplugin/testplugin/static/js/testplugin/controllers' controllers_dir = self.path / rpath scaffold.start_plugin(self.args, self.path) self.assertTrue(controllers_dir.is_dir)
def test_has_lookuplists_dir(self, os): rpath = 'opal-testplugin/testplugin/data/lookuplists/' lookuplists = self.path / rpath scaffold.start_plugin(self.args, self.path) self.assertTrue(bool(lookuplists))
def test_creates_static_directory(self): static_dir = self.path/'opal-testplugin/testplugin/static' scaffold.start_plugin(self.args, self.path) self.assertTrue(static_dir.is_dir)
def test_creates_template_directory(self, os): template_dir = self.path/'opal-testplugin/testplugin/templates' scaffold.start_plugin(self.args, self.path) self.assertTrue(template_dir.is_dir)
def test_initialize_git(self, subpr): scaffold.start_plugin(self.args, self.path) subpr.assert_any_call(('git', 'init'), cwd=self.path / 'opal-testplugin', stdout=subprocess.PIPE)
def test_creates_static_directory(self, subpr): static_dir = self.path/'opal-testplugin/testplugin/static' scaffold.start_plugin(self.args, self.path) self.assertTrue(static_dir.is_dir)