Ejemplo n.º 1
0
def test_scope_remove_does_not_exist():
    scope = oauth2.Scope(oauth2.Read(), oauth2.Write(1),
                         oauth2.Delegate(2, oauth2.Write(3)))
    scope.remove(oauth2.Write(5))

    assert str(scope) == 'delegate[2]:write[3] read write[1]'
Ejemplo n.º 2
0
def test_scope_remove():
    scope = oauth2.Scope(oauth2.Read(), oauth2.Write(1),
                         oauth2.Delegate(2, oauth2.Write(3)))
    scope.remove(oauth2.Write(1))

    assert str(scope) == 'delegate[2]:write[3] read'
Ejemplo n.º 3
0
def test_scope_add():
    scope = oauth2.Scope(oauth2.Read(), oauth2.Write(1),
                         oauth2.Delegate(2, oauth2.Write(3)))
    scope.add(oauth2.Write(4))

    assert str(scope) == 'delegate[2]:write[3] read write[1] write[4]'
Ejemplo n.º 4
0
def test_delegate_noone():
    with pytest.raises(TypeError):
        oauth2.Delegate()
Ejemplo n.º 5
0
def test_delegate_nothing():
    with pytest.raises(TypeError):
        oauth2.Delegate('x')
Ejemplo n.º 6
0
def test_delegate_write_something():
    obj = oauth2.Delegate('other', oauth2.Write('something'))
    assert str(obj) == 'delegate[other]:write[something]'
    assert obj.resource_id == 'other'
    assert obj.access == oauth2.Write('something')