Exemplo n.º 1
0
def test_update(st):
    policy = Policy('1')
    st.add(policy)
    assert '1' == st.get('1').uid
    assert None is st.get('1').description
    policy.description = 'foo'
    st.update(policy)
    assert '1' == st.get('1').uid
    assert 'foo' == st.get('1').description
Exemplo n.º 2
0
 def test_update(self, st):
     id = str(uuid.uuid4())
     policy = Policy(id)
     st.add(policy)
     assert id == st.get(id).uid
     assert None is st.get(id).description
     assert [] == st.get(id).actions
     policy.description = 'foo'
     policy.actions = ['a', 'b', 'c']
     st.update(policy)
     assert id == st.get(id).uid
     assert 'foo' == st.get(id).description
     assert ['a', 'b', 'c'] == st.get(id).actions
Exemplo n.º 3
0
def test_update(st):
    policy = Policy('1')
    st.add(policy)
    assert '1' == st.get('1').uid
    assert None is st.get('1').description
    policy.description = 'foo'
    st.update(policy)
    assert '1' == st.get('1').uid
    assert 'foo' == st.get('1').description
    p = Policy(2, actions=[Any()], subjects=[Eq('max'), Eq('bob')])
    st.add(p)
    assert 2 == st.get(2).uid
    p.actions = [Eq('get')]
    st.update(p)
    assert 1 == len(st.get(2).actions)
    assert 'get' == st.get(2).actions[0].val
Exemplo n.º 4
0
 def test_update(self, st):
     id = str(uuid.uuid4())
     policy = Policy(id)
     st.add(policy)
     assert id == st.get(id).uid
     assert None is st.get(id).description
     assert () == st.get(id).actions or [] == st.get(id).actions
     policy.description = 'foo'
     policy.actions = ['a', 'b', 'c']
     st.update(policy)
     assert id == st.get(id).uid
     assert 'foo' == st.get(id).description
     assert ['a', 'b', 'c'] == st.get(id).actions
     p = Policy(2, actions=[Any()], subjects=[Eq('max'), Eq('bob')])
     st.add(p)
     assert 2 == st.get(2).uid
     p.actions = [Eq('get')]
     st.update(p)
     assert 1 == len(st.get(2).actions)
     assert 'get' == st.get(2).actions[0].val
Exemplo n.º 5
0
 def test_update(self, st):
     # SQL storage stores all uids as string
     id = str(uuid.uuid4())
     policy = Policy(id)
     st.add(policy)
     assert id == st.get(id).uid
     assert None is st.get(id).description
     assert [] == st.get(id).actions
     policy.description = 'foo'
     policy.actions = ['a', 'b', 'c']
     st.update(policy)
     assert id == st.get(id).uid
     assert 'foo' == st.get(id).description
     assert ['a', 'b', 'c'] == st.get(id).actions
     p = Policy('2', actions=[Any()], subjects=[Eq('max'), Eq('bob')])
     st.add(p)
     assert '2' == st.get('2').uid
     p.actions = [Eq('get')]
     st.update(p)
     assert 1 == len(st.get('2').actions)
     assert 'get' == st.get('2').actions[0].val