from opal.core.test import OpalTestCase

from opal.core import commandline

from mock import patch, MagicMock

from opal.core.test import OpalTestCase

from opal.core import commandline


class StartprojectTestCase(OpalTestCase):

    def test_startproject(self):
        mock_args = MagicMock(name='Mock Args')
        mock_args.name = 'projectname'
        with patch.object(commandline.scaffold_utils, 'start_project') as sp:
            commandline.startproject(mock_args)
            sp.assert_called_with('projectname', commandline.USERLAND_HERE)


class StartpluginTestCase(OpalTestCase):

    def test_startplugin(self):
        mock_args = MagicMock(name='Mock Args')
        mock_args.name = 'pluginname'
        with patch.object(commandline.scaffold_utils, 'start_plugin') as sp:
            commandline.startplugin(mock_args)
            sp.assert_called_with('pluginname', commandline.USERLAND_HERE)

Add simple basic unittests for some of our commandline argparse target functions
Add simple basic unittests for some of our commandline argparse target functions

+ from mock import patch, MagicMock
+ 
  from opal.core.test import OpalTestCase
  
  from opal.core import commandline
  
+ 
+ class StartprojectTestCase(OpalTestCase):
+ 
+     def test_startproject(self):
+         mock_args = MagicMock(name='Mock Args')
+         mock_args.name = 'projectname'
+         with patch.object(commandline.scaffold_utils, 'start_project') as sp:
+             commandline.startproject(mock_args)
+             sp.assert_called_with('projectname', commandline.USERLAND_HERE)
+ 
+ 
+ class StartpluginTestCase(OpalTestCase):
+ 
+     def test_startplugin(self):
+         mock_args = MagicMock(name='Mock Args')
+         mock_args.name = 'pluginname'
+         with patch.object(commandline.scaffold_utils, 'start_plugin') as sp:
+             commandline.startplugin(mock_args)
+             sp.assert_called_with('pluginname', commandline.USERLAND_HERE)
+ 
Add simple basic unittests for some of our commandline argparse target functions
## Code Before:
from opal.core.test import OpalTestCase

from opal.core import commandline

## Instruction:
Add simple basic unittests for some of our commandline argparse target functions
## Code After:
from mock import patch, MagicMock

from opal.core.test import OpalTestCase

from opal.core import commandline


class StartprojectTestCase(OpalTestCase):

    def test_startproject(self):
        mock_args = MagicMock(name='Mock Args')
        mock_args.name = 'projectname'
        with patch.object(commandline.scaffold_utils, 'start_project') as sp:
            commandline.startproject(mock_args)
            sp.assert_called_with('projectname', commandline.USERLAND_HERE)


class StartpluginTestCase(OpalTestCase):

    def test_startplugin(self):
        mock_args = MagicMock(name='Mock Args')
        mock_args.name = 'pluginname'
        with patch.object(commandline.scaffold_utils, 'start_plugin') as sp:
            commandline.startplugin(mock_args)
            sp.assert_called_with('pluginname', commandline.USERLAND_HERE)
