Exemple #1
0
def test_get_argv_options_integration(context):
    u"Nose should parse sys.argv and figure out whether to run as integration"
    sys.argv = ['./manage.py', 'test', '--integration']
    runner = Nose()

    opts = runner.get_argv_options()
    assert that(opts['is_unit']).equals(False)
    assert that(opts['is_functional']).equals(False)
    assert that(opts['is_integration']).equals(True)
Exemple #2
0
def test_get_argv_options_simple(context):
    u"Nose should parse sys.argv"
    sys.argv = ['./manage.py', 'test']
    runner = Nose()

    opts = runner.get_argv_options()
    assert that(opts['is_unit']).equals(False)
    assert that(opts['is_functional']).equals(False)
    assert that(opts['is_integration']).equals(False)
Exemple #3
0
def test_get_argv_options_integration(context):
    u"Nose should parse sys.argv and figure out whether to run as integration"
    sys.argv = ['./manage.py', 'test', '--integration']
    runner = Nose()

    opts = runner.get_argv_options()
    assert that(opts['is_unit']).equals(False)
    assert that(opts['is_functional']).equals(False)
    assert that(opts['is_integration']).equals(True)
Exemple #4
0
def test_get_argv_options_simple(context):
    u"Nose should parse sys.argv"
    sys.argv = ['./manage.py', 'test']
    runner = Nose()

    opts = runner.get_argv_options()
    assert that(opts['is_unit']).equals(False)
    assert that(opts['is_functional']).equals(False)
    assert that(opts['is_integration']).equals(False)
Exemple #5
0
def test_should_try_loading_test_cmd_class(context,
                                           load_command_class,
                                           get_commands):
    u"Nose should try loading the 'test' command class"
    sys.argv = ['./manage.py', 'test',
                '--unit', '--functional', '--integration']
    runner = Nose()

    command_mock = mock.Mock()
    get_commands.return_value = {'test': 'string to load'}
    load_command_class.return_value = command_mock
    command_mock.option_list = []

    opts = runner.get_argv_options()
    assert that(opts['is_unit']).equals(True)
    assert that(opts['is_functional']).equals(True)
    assert that(opts['is_integration']).equals(True)

    get_commands.assert_called_once_with()
    load_command_class.assert_called_once_with('django.core', 'test')
Exemple #6
0
def test_should_try_loading_test_cmd_class(context, load_command_class,
                                           get_commands):
    u"Nose should try loading the 'test' command class"
    sys.argv = [
        './manage.py', 'test', '--unit', '--functional', '--integration'
    ]
    runner = Nose()

    command_mock = mock.Mock()
    get_commands.return_value = {'test': 'string to load'}
    load_command_class.return_value = command_mock
    command_mock.option_list = []

    opts = runner.get_argv_options()
    assert that(opts['is_unit']).equals(True)
    assert that(opts['is_functional']).equals(True)
    assert that(opts['is_integration']).equals(True)

    get_commands.assert_called_once_with()
    load_command_class.assert_called_once_with('django.core', 'test')