def test_script(self, execute_manager): # The manage script is a replacement for the default manage.py # script. It has all the same bells and whistles since all it # does is call the normal Django stuff. from djangorecipe import manage manage.main('cheeseshop.development') self.assertEqual(execute_manager.call_args, ((self.settings, ), {}))
def test_script(self, execute_manager): # The manage script is a replacement for the default manage.py # script. It has all the same bells and whistles since all it # does is call the normal Django stuff. manage.main('cheeseshop.development') self.assertEqual(execute_manager.call_args, ((self.settings,), {}))
def test_script(self, mock_setdefault, mock_execute): # The manage script is a replacement for the default manage.py # script. It has all the same bells and whistles since all it # does is call the normal Django stuff. from djangorecipe import manage manage.main("cheeseshop.development") self.assertEqual(mock_execute.call_args, ((sys.argv,), {})) self.assertEqual(mock_setdefault.call_args, (("DJANGO_SETTINGS_MODULE", "cheeseshop.development"), {}))
def test_script(self, mock_setdefault, mock_execute): # The manage script is a replacement for the default manage.py # script. It has all the same bells and whistles since all it # does is call the normal Django stuff. from djangorecipe import manage manage.main('cheeseshop.development') self.assertEqual(mock_execute.call_args, ((sys.argv, ), {})) self.assertEqual( mock_setdefault.call_args, (('DJANGO_SETTINGS_MODULE', 'cheeseshop.development'), {}))
def test_django_pre_14_selection(self, mock_14, mock_pre_14): from djangorecipe import manage manage.main('cheeseshop.development') self.assertTrue(mock_14.called) self.assertFalse(mock_pre_14.called)
def test_settings_error(self, sys_exit): # When the settings file cannot be imported the management # script it wil exit with a message and a specific exit code. manage.main('cheeseshop.tilsit') self.assertEqual(sys_exit.call_args, ((1,), {}))