示例#1
0
def test_before_feature(start_driver):
    # Create context mock
    context = mock.MagicMock()
    context.toolium_config = ExtendedConfigParser()
    feature = mock.MagicMock()
    feature.tags = ['a', 'b']

    before_feature(context, feature)

    # Check that start_driver is not called
    start_driver.assert_not_called()
示例#2
0
def test_before_feature_reuse_driver_no_driver(start_driver):
    # Create context mock
    context = mock.MagicMock()
    context.toolium_config = ExtendedConfigParser()
    feature = mock.MagicMock()
    feature.tags = ['a', 'reuse_driver', 'b', 'no_driver']

    before_feature(context, feature)

    # Check that start_driver is called when reuse_driver tag, with True no_driver param
    start_driver.assert_called_once_with(context, True)
    assert context.reuse_driver_from_tags is True