Esempio n. 1
0
 def test_command_with_args(self):
     mock = MagicMock()
     with patch.dict(django.__salt__, {"cmd.run": mock}):
         django.command("settings.py", "runserver", None, None, "noinput", "somethingelse")
         mock.assert_called_once_with(
             "django-admin.py runserver --settings=settings.py " "--noinput --somethingelse"
         )
Esempio n. 2
0
 def test_django_admin_cli_command(self):
     mock = MagicMock()
     with patch.dict(djangomod.__salt__, {'cmd.run': mock}):
         djangomod.command('settings.py', 'runserver')
         mock.assert_called_once_with(
             'django-admin.py runserver --settings=settings.py',
             python_shell=False,
             env=None)
Esempio n. 3
0
 def test_command_with_args(self):
     mock = MagicMock()
     with patch.dict(django.__salt__, {'cmd.run': mock}):
         django.command('settings.py', 'runserver', None, None, 'noinput',
                        'somethingelse')
         mock.assert_called_once_with(
             'django-admin.py runserver --settings=settings.py '
             '--noinput --somethingelse')
Esempio n. 4
0
 def test_command(self):
     mock = MagicMock()
     with patch.dict(django.__salt__,
                     {'cmd.run': mock}):
         django.command('settings.py', 'runserver')
         mock.assert_called_once_with(
             'django-admin.py runserver --settings=settings.py',
             env=None
         )
Esempio n. 5
0
 def test_command(self):
     mock = MagicMock()
     with patch.dict(django.__salt__,
                     {'cmd.run': mock}):
         django.command('settings.py', 'runserver')
         mock.assert_called_once_with(
             'django-admin.py runserver --settings=settings.py',
             env=None
         )
Esempio n. 6
0
 def test_command_with_kwargs_ignore_dunder(self):
     mock = MagicMock()
     with patch.dict(django.__salt__, {'cmd.run': mock}):
         django.command('settings.py',
                        'runserver',
                        None,
                        None,
                        __ignore='something')
         mock.assert_called_once_with(
             'django-admin.py runserver --settings=settings.py')
Esempio n. 7
0
 def test_django_admin_cli_command(self):
     mock = MagicMock()
     with patch.dict(djangomod.__salt__, {"cmd.run": mock}):
         djangomod.command("settings.py", "runserver")
         mock.assert_called_once_with(
             "django-admin.py runserver --settings=settings.py",
             python_shell=False,
             env=None,
             runas=None,
         )
Esempio n. 8
0
 def test_command_with_kwargs_ignore_dunder(self):
     mock = MagicMock()
     with patch.dict(django.__salt__,
                     {'cmd.run': mock}):
         django.command(
             'settings.py', 'runserver', None, None, __ignore='something'
         )
         mock.assert_called_once_with(
             'django-admin.py runserver --settings=settings.py',
             env=None
         )
Esempio n. 9
0
 def test_django_admin_cli_command_with_args(self):
     mock = MagicMock()
     with patch.dict(djangomod.__salt__, {'cmd.run': mock}):
         djangomod.command('settings.py', 'runserver', None, None, None,
                           None, 'noinput', 'somethingelse')
         mock.assert_called_once_with(
             'django-admin.py runserver --settings=settings.py '
             '--noinput --somethingelse',
             python_shell=False,
             env=None,
             runas=None)
Esempio n. 10
0
 def test_command_with_kwargs(self):
     mock = MagicMock()
     with patch.dict(django.__salt__, {'cmd.run': mock}):
         django.command('settings.py',
                        'runserver',
                        None,
                        None,
                        database='something')
         mock.assert_called_once_with(
             'django-admin.py runserver --settings=settings.py '
             '--database=something',
             env=None)
Esempio n. 11
0
 def test_django_admin_cli_command_with_kwargs_ignore_dunder(self):
     mock = MagicMock()
     with patch.dict(djangomod.__salt__,
                     {'cmd.run': mock}):
         djangomod.command(
             'settings.py', 'runserver', None, None, None, __ignore='something'
         )
         mock.assert_called_once_with(
             'django-admin.py runserver --settings=settings.py',
             python_shell=False,
             env=None,
             runas=None
         )
Esempio n. 12
0
 def test_command(self):
     """
     Test if it runs arbitrary django management command
     """
     mock = MagicMock(return_value=True)
     with patch.dict(djangomod.__salt__, {"cmd.run": mock}):
         self.assertTrue(djangomod.command("DJANGO_SETTINGS_MODULE", "validate"))
Esempio n. 13
0
 def test_command_with_kwargs(self):
     mock = MagicMock()
     with patch.dict(django.__salt__,
                     {'cmd.run': mock}):
         django.command(
             'settings.py',
             'runserver',
             None,
             None,
             database='something'
         )
         mock.assert_called_once_with(
             'django-admin.py runserver --settings=settings.py '
             '--database=something',
             python_shell=False,
             env=None
         )
Esempio n. 14
0
 def test_command(self):
     '''
     Test if it runs arbitrary django management command
     '''
     mock = MagicMock(return_value=True)
     with patch.dict(djangomod.__salt__, {'cmd.run': mock}):
         self.assertTrue(djangomod.command('DJANGO_SETTINGS_MODULE',
                                           'validate'))
Esempio n. 15
0
 def test_command_with_args(self):
     mock = MagicMock()
     with patch.dict(django.__salt__,
                     {'cmd.run': mock}):
         django.command(
             'settings.py',
             'runserver',
             None,
             None,
             None,
             'noinput',
             'somethingelse'
         )
         mock.assert_called_once_with(
             'django-admin.py runserver --settings=settings.py '
             '--noinput --somethingelse',
             env=None
         )
Esempio n. 16
0
 def test_command_with_kwargs_ignore_dunder(self):
     mock = MagicMock()
     with patch.dict(django.__salt__, {"cmd.run": mock}):
         django.command("settings.py", "runserver", None, None, __ignore="something")
         mock.assert_called_once_with("django-admin.py runserver --settings=settings.py")
Esempio n. 17
0
 def test_command(self):
     mock = MagicMock()
     with patch.dict(django.__salt__, {"cmd.run": mock}):
         django.command("settings.py", "runserver")
         mock.assert_called_once_with("django-admin.py runserver --settings=settings.py")