Пример #1
0
    def test_manage_command_manage_manage_collect_no_input(self, mock_run_process):
        # mock the input args
        args = mock.MagicMock(manage='', command=MANAGE_COLLECT, port='8080', noinput=True)

        # call the testing method with the mock args
        manage_commands.manage_command(args)

        # get the call arguments for the run process mock method
        process_call_args = mock_run_process.call_args_list

        # pre_collectstatic
        self.assertEquals('python', process_call_args[0][0][0][0])
        self.assertIn('manage.py', process_call_args[0][0][0][1])
        self.assertEquals('pre_collectstatic', process_call_args[0][0][0][2])

        # collectstatic
        self.assertEquals('python', process_call_args[1][0][0][0])
        self.assertIn('manage.py', process_call_args[1][0][0][1])
        self.assertEquals('collectstatic', process_call_args[1][0][0][2])
        self.assertEquals('--noinput', process_call_args[1][0][0][3])

        # collectworkspaces
        self.assertEquals('python', process_call_args[2][0][0][0])
        self.assertIn('manage.py', process_call_args[2][0][0][1])
        self.assertEquals('collectworkspaces', process_call_args[2][0][0][2])
Пример #2
0
    def test_manage_command_manage_manage_collect_no_input(self, mock_run_process):
        # mock the input args
        args = mock.MagicMock(manage='', command=MANAGE_COLLECT, port='8080', noinput=True)

        # call the testing method with the mock args
        manage_commands.manage_command(args)

        # get the call arguments for the run process mock method
        process_call_args = mock_run_process.call_args_list

        # pre_collectstatic
        self.assertEquals('python', process_call_args[0][0][0][0])
        self.assertIn('manage.py', process_call_args[0][0][0][1])
        self.assertEquals('pre_collectstatic', process_call_args[0][0][0][2])

        # collectstatic
        self.assertEquals('python', process_call_args[1][0][0][0])
        self.assertIn('manage.py', process_call_args[1][0][0][1])
        self.assertEquals('collectstatic', process_call_args[1][0][0][2])
        self.assertEquals('--noinput', process_call_args[1][0][0][3])

        # collectworkspaces
        self.assertEquals('python', process_call_args[2][0][0][0])
        self.assertIn('manage.py', process_call_args[2][0][0][1])
        self.assertEquals('collectworkspaces', process_call_args[2][0][0][2])
Пример #3
0
    def test_manage_command_manage_manage_sync(self, MockSingletonHarvester):
        # mock the input args
        args = mock.MagicMock(manage='', command=MANAGE_SYNC, port='8080')

        # call the testing method with the mock args
        manage_commands.manage_command(args)

        # mock the singleton harvester
        MockSingletonHarvester.assert_called()
        MockSingletonHarvester().harvest.assert_called()
Пример #4
0
    def test_manage_command_manage_manage_sync(self, MockSingletonHarvester):
        # mock the input args
        args = mock.MagicMock(manage='', command=MANAGE_SYNC, port='8080')

        # call the testing method with the mock args
        manage_commands.manage_command(args)

        # mock the singleton harvester
        MockSingletonHarvester.assert_called()
        MockSingletonHarvester().harvest.assert_called()
Пример #5
0
    def test_manage_command_manage_start_with_no_port(self, mock_run_process):
        # mock the input args
        args = mock.MagicMock(manage='', command=MANAGE_START, port='')

        # call the testing method with the mock args
        manage_commands.manage_command(args)

        # get the call arguments for the run process mock method
        process_call_args = mock_run_process.call_args_list

        # check the values from the argument list
        self.assertEquals('python', process_call_args[0][0][0][0])
        self.assertIn('manage.py', process_call_args[0][0][0][1])
        self.assertEquals('runserver', process_call_args[0][0][0][2])
Пример #6
0
    def test_manage_command_manage_manage_create_super_user(self, mock_run_process):
        # mock the input args
        args = mock.MagicMock(manage='', command=MANAGE_CREATESUPERUSER, port='8080')

        # call the testing method with the mock args
        manage_commands.manage_command(args)

        # get the call arguments for the run process mock method
        process_call_args = mock_run_process.call_args_list

        # check the values from the argument list
        self.assertEquals('python', process_call_args[0][0][0][0])
        self.assertIn('manage.py', process_call_args[0][0][0][1])
        self.assertEquals('createsuperuser', process_call_args[0][0][0][2])
Пример #7
0
    def test_manage_command_manage_start_with_no_port(self, mock_run_process):
        # mock the input args
        args = mock.MagicMock(manage='', command=MANAGE_START, port='')

        # call the testing method with the mock args
        manage_commands.manage_command(args)

        # get the call arguments for the run process mock method
        process_call_args = mock_run_process.call_args_list

        # check the values from the argument list
        self.assertEquals('python', process_call_args[0][0][0][0])
        self.assertIn('manage.py', process_call_args[0][0][0][1])
        self.assertEquals('runserver', process_call_args[0][0][0][2])
Пример #8
0
    def test_manage_command_manage_manage_create_super_user(self, mock_run_process):
        # mock the input args
        args = mock.MagicMock(manage='', command=MANAGE_CREATESUPERUSER, port='8080')

        # call the testing method with the mock args
        manage_commands.manage_command(args)

        # get the call arguments for the run process mock method
        process_call_args = mock_run_process.call_args_list

        # check the values from the argument list
        self.assertEquals('python', process_call_args[0][0][0][0])
        self.assertIn('manage.py', process_call_args[0][0][0][1])
        self.assertEquals('createsuperuser', process_call_args[0][0][0][2])
Пример #9
0
    def test_manage_command_manage_manage_collect_workspace_with_no_force(self, mock_run_process):
        # mock the input args
        args = mock.MagicMock(manage='', command=MANAGE_COLLECTWORKSPACES, force=False)

        # call the testing method with the mock args
        manage_commands.manage_command(args)

        # get the call arguments for the run process mock method
        process_call_args = mock_run_process.call_args_list

        # check the values from the argument list
        self.assertEquals('python', process_call_args[0][0][0][0])
        self.assertIn('manage.py', process_call_args[0][0][0][1])
        self.assertEquals('collectworkspaces', process_call_args[0][0][0][2])
        self.assertNotIn('--force', process_call_args[0][0][0])
Пример #10
0
    def test_manage_command_manage_manage_collect_workspace_with_no_force(self, mock_run_process):
        # mock the input args
        args = mock.MagicMock(manage='', command=MANAGE_COLLECTWORKSPACES, force=False)

        # call the testing method with the mock args
        manage_commands.manage_command(args)

        # get the call arguments for the run process mock method
        process_call_args = mock_run_process.call_args_list

        # check the values from the argument list
        self.assertEquals('python', process_call_args[0][0][0][0])
        self.assertIn('manage.py', process_call_args[0][0][0][1])
        self.assertEquals('collectworkspaces', process_call_args[0][0][0][2])
        self.assertNotIn('--force', process_call_args[0][0][0])
Пример #11
0
    def test_manage_command_manage_syncdb(self, mock_run_process):
        # mock the input args
        args = mock.MagicMock(manage='', command=MANAGE_SYNCDB, port='8080')

        # call the testing method with the mock args
        manage_commands.manage_command(args)

        # get the call arguments for the run process mock method
        process_call_args = mock_run_process.call_args_list

        # intermediate process
        self.assertEquals('python', process_call_args[0][0][0][0])
        self.assertIn('manage.py', process_call_args[0][0][0][1])
        self.assertEquals('makemigrations', process_call_args[0][0][0][2])

        # primary process
        self.assertEquals('python', process_call_args[1][0][0][0])
        self.assertIn('manage.py', process_call_args[1][0][0][1])
        self.assertEquals('migrate', process_call_args[1][0][0][2])
Пример #12
0
    def test_manage_command_manage_syncdb(self, mock_run_process):
        # mock the input args
        args = mock.MagicMock(manage='', command=MANAGE_SYNCDB, port='8080')

        # call the testing method with the mock args
        manage_commands.manage_command(args)

        # get the call arguments for the run process mock method
        process_call_args = mock_run_process.call_args_list

        # intermediate process
        self.assertEquals('python', process_call_args[0][0][0][0])
        self.assertIn('manage.py', process_call_args[0][0][0][1])
        self.assertEquals('makemigrations', process_call_args[0][0][0][2])

        # primary process
        self.assertEquals('python', process_call_args[1][0][0][0])
        self.assertIn('manage.py', process_call_args[1][0][0][1])
        self.assertEquals('migrate', process_call_args[1][0][0][2])
Пример #13
0
    def test_manage_command_manage_manage_collectstatic(self, mock_run_process):
        # mock the input args
        args = mock.MagicMock(manage='', command=MANAGE_COLLECTSTATIC, port='8080', noinput=False)

        # call the testing method with the mock args
        manage_commands.manage_command(args)

        # get the call arguments for the run process mock method
        process_call_args = mock_run_process.call_args_list

        # intermediate process
        self.assertEquals('python', process_call_args[0][0][0][0])
        self.assertIn('manage.py', process_call_args[0][0][0][1])
        self.assertEquals('pre_collectstatic', process_call_args[0][0][0][2])

        # primary process
        self.assertEquals('python', process_call_args[1][0][0][0])
        self.assertIn('manage.py', process_call_args[1][0][0][1])
        self.assertEquals('collectstatic', process_call_args[1][0][0][2])
        self.assertNotIn('--noinput', process_call_args[1][0][0])
Пример #14
0
    def test_manage_command_manage_manage_collectstatic(self, mock_run_process):
        # mock the input args
        args = mock.MagicMock(manage='', command=MANAGE_COLLECTSTATIC, port='8080', noinput=False)

        # call the testing method with the mock args
        manage_commands.manage_command(args)

        # get the call arguments for the run process mock method
        process_call_args = mock_run_process.call_args_list

        # intermediate process
        self.assertEquals('python', process_call_args[0][0][0][0])
        self.assertIn('manage.py', process_call_args[0][0][0][1])
        self.assertEquals('pre_collectstatic', process_call_args[0][0][0][2])

        # primary process
        self.assertEquals('python', process_call_args[1][0][0][0])
        self.assertIn('manage.py', process_call_args[1][0][0][1])
        self.assertEquals('collectstatic', process_call_args[1][0][0][2])
        self.assertNotIn('--noinput', process_call_args[1][0][0])