def test_createsuperuser(self): mock = MagicMock() with patch.dict(django.__salt__, {'cmd.run': mock}): django.createsuperuser('settings.py', 'testuser', '*****@*****.**') mock.assert_called_once_with( 'django-admin.py createsuperuser --settings=settings.py ' '--noinput --username=testuser [email protected]')
def test_createsuperuser(self): mock = MagicMock() with patch.dict(django.__salt__, {"cmd.run": mock}): django.createsuperuser("settings.py", "testuser", "*****@*****.**") mock.assert_called_once_with( "django-admin.py createsuperuser --settings=settings.py " "--noinput --username=testuser [email protected]" )
def test_createsuperuser(self): mock = MagicMock() with patch.dict(django.__salt__, {'cmd.run': mock}): django.createsuperuser( 'settings.py', 'testuser', '*****@*****.**' ) mock.assert_called_once_with( 'django-admin.py createsuperuser --settings=settings.py ' '--noinput --username=testuser [email protected]', env=None )
def test_django_admin_cli_createsuperuser(self): mock = MagicMock() with patch.dict(djangomod.__salt__, {"cmd.run": mock}): djangomod.createsuperuser("settings.py", "testuser", "*****@*****.**") self.assertEqual(mock.call_count, 1) mock.assert_called_with( "django-admin.py createsuperuser --settings=settings.py --noinput " "[email protected] --username=testuser", env=None, python_shell=False, runas=None, )
def test_django_admin_cli_createsuperuser(self): mock = MagicMock() with patch.dict(djangomod.__salt__, {'cmd.run': mock}): djangomod.createsuperuser('settings.py', 'testuser', '*****@*****.**') self.assertEqual(mock.call_count, 1) args, kwargs = mock.call_args # cmdline arguments are extracted from a kwargs dict so order isn't guaranteed. self.assertEqual(len(args), 1) self.assertTrue( args[0].startswith('django-admin.py createsuperuser --')) self.assertEqual( set(args[0].split()), set('django-admin.py createsuperuser --settings=settings.py --noinput ' '--username=testuser [email protected]'.split())) self.assertDictEqual(kwargs, {'python_shell': False, 'env': None})
def test_createsuperuser(self): """ Test if it create a super user for the database. """ mock = MagicMock(return_value=True) with patch.dict(djangomod.__salt__, {"cmd.run": mock}): self.assertTrue( djangomod.createsuperuser("DJANGO_SETTINGS_MODULE", "SALT", "*****@*****.**"))
def test_createsuperuser(self): ''' Test if it create a super user for the database. ''' mock = MagicMock(return_value=True) with patch.dict(djangomod.__salt__, {'cmd.run': mock}): self.assertTrue(djangomod.createsuperuser('DJANGO_SETTINGS_MODULE', 'SALT', '*****@*****.**'))
def test_django_admin_cli_createsuperuser(self): mock = MagicMock() with patch.dict(djangomod.__salt__, {"cmd.run": mock}): djangomod.createsuperuser("settings.py", "testuser", "*****@*****.**") self.assertEqual(mock.call_count, 1) args, kwargs = mock.call_args # cmdline arguments are extracted from a kwargs dict so order isn't guaranteed. self.assertEqual(len(args), 1) self.assertTrue(args[0].startswith("django-admin.py createsuperuser --")) self.assertEqual( set(args[0].split()), set( "django-admin.py createsuperuser --settings=settings.py --noinput " "--username=testuser [email protected]".split() ), ) self.assertDictEqual( kwargs, {"python_shell": False, "env": None, "runas": None} )