def test_wrap_spec_if_needed_str():
    dehydrator = Dehydrator()

    wrapped = dehydrator.wrap_spec_if_needed(spec='login')

    assert isinstance(wrapped, S)
    assert wrapped.target == 'login'
def test_wrap_spec_if_needed_S():
    dehydrator = Dehydrator()

    spec = S('login')
    wrapped = dehydrator.wrap_spec_if_needed(spec=spec)

    assert wrapped is spec
def test_wrap_spec_if_needed_S():
    dehydrator = Dehydrator()

    spec = S('login')
    wrapped = dehydrator.wrap_spec_if_needed(spec=spec)

    assert wrapped is spec
def test_wrap_spec_if_needed_str():
    dehydrator = Dehydrator()

    wrapped = dehydrator.wrap_spec_if_needed(spec='login')

    assert isinstance(wrapped, S)
    assert wrapped.target == 'login'
def test_wrap_spec_if_needed_two_str_tuple():
    dehydrator = Dehydrator()

    wrapped = dehydrator.wrap_spec_if_needed(spec=('login', 'username'))

    assert isinstance(wrapped, S)
    assert wrapped.target == 'login'
    assert wrapped.substitution == 'username'
def test_wrap_spec_if_needed_two_str_tuple():
    dehydrator = Dehydrator()

    wrapped = dehydrator.wrap_spec_if_needed(spec=('login', 'username'))

    assert isinstance(wrapped, S)
    assert wrapped.target == 'login'
    assert wrapped.substitution == 'username'
def test_wrap_spec_if_needed_wrong_type():
    dehydrator = Dehydrator()

    with raises(DehydrationException):
        dehydrator.wrap_spec_if_needed(spec={'wrong': 'type'})
def test_wrap_spec_if_needed_wrong_type():
    dehydrator = Dehydrator()

    with raises(DehydrationException):
        dehydrator.wrap_spec_if_needed(spec={'wrong': 'type'})