def test_parent_overrides_subresource_state(): doc = perch.SubResource( state=perch.State.approved.name, parent=perch.Document(state=perch.State.rejected.name)) assert doc.state == perch.State.rejected doc = perch.SubResource( state=perch.State.pending.name, parent=perch.Document(state=perch.State.approved.name)) assert doc.state == perch.State.pending
def test_subresource_state_without_parent(): doc = perch.SubResource() with pytest.raises(Exception): doc.state
def test_subresource_default_state(): doc = perch.SubResource(parent=perch.Document()) assert doc.state == perch.SubResource.default_state
def test_subresource_with_state_object(): """Accept a state object in __init__""" doc = perch.SubResource(state=perch.State.approved, parent=perch.Document(state=perch.State.approved)) assert doc.state == perch.State.approved
def test_subresource_state(): doc = perch.SubResource( state=perch.State.approved.name, parent=perch.Document(state=perch.State.approved.name)) assert doc.state == perch.State.approved