Example #1
0
 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]')
Example #2
0
 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]"
         )
Example #3
0
 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
         )
Example #4
0
 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,
         )
Example #5
0
 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})
Example #6
0
 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",
                                       "*****@*****.**"))
Example #7
0
 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',
                                                   '*****@*****.**'))
Example #8
0
 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}
         )