Skip to content
Snippets Groups Projects
Verified Commit 3a3fac16 authored by Timm Fitschen's avatar Timm Fitschen
Browse files

STY: autopep8'ed test_state and test_affiliation

parent 0cec1c7d
No related branches found
No related tags found
1 merge request!3F fsm
Pipeline #6366 passed
...@@ -65,7 +65,6 @@ def teardown(): ...@@ -65,7 +65,6 @@ def teardown():
def test_affiliation_there(): def test_affiliation_there():
par = db.RecordType(name="TestRT1") par = db.RecordType(name="TestRT1")
ch = db.Record(name="TestRec").add_parent(par) ch = db.Record(name="TestRec").add_parent(par)
print(ch)
assert_is_not_none(ch.get_parent("TestRT1")) assert_is_not_none(ch.get_parent("TestRT1"))
assert_true(hasattr(ch.get_parent("TestRT1"), "affiliation")) assert_true(hasattr(ch.get_parent("TestRT1"), "affiliation"))
......
...@@ -713,7 +713,7 @@ def test_unauthorized_final(): ...@@ -713,7 +713,7 @@ def test_unauthorized_final():
switch_to_test_user("normal") switch_to_test_user("normal")
rec.state = None rec.state = None
with pytest.raises(db.TransactionError) as exc: with pytest.raises(db.TransactionError) as exc:
rec.update(sync = False) rec.update(sync=False)
assert "You are not allowed to do this." in str(exc.value) assert "You are not allowed to do this." in str(exc.value)
rec_retrieve = db.Record(id=rec.id).retrieve() rec_retrieve = db.Record(id=rec.id).retrieve()
...@@ -736,7 +736,7 @@ def test_unauthorized_initial(): ...@@ -736,7 +736,7 @@ def test_unauthorized_initial():
rec.state = db.State(model="Model1", name="State1") rec.state = db.State(model="Model1", name="State1")
with pytest.raises(db.TransactionError) as exc: with pytest.raises(db.TransactionError) as exc:
# normal user lacks the permission for the initial state # normal user lacks the permission for the initial state
rec.update(sync = False) rec.update(sync=False)
assert "You are not allowed to do this." in str(exc.value) assert "You are not allowed to do this." in str(exc.value)
rec_retrieve = db.Record(id=rec.id).retrieve() rec_retrieve = db.Record(id=rec.id).retrieve()
assert rec_retrieve.state is None assert rec_retrieve.state is None
...@@ -744,7 +744,7 @@ def test_unauthorized_initial(): ...@@ -744,7 +744,7 @@ def test_unauthorized_initial():
switch_to_test_user("team-leader") switch_to_test_user("team-leader")
with pytest.raises(db.TransactionError) as exc: with pytest.raises(db.TransactionError) as exc:
# it is not allowed to "steal" the entity with the state feature # it is not allowed to "steal" the entity with the state feature
rec.update(sync = False) rec.update(sync=False)
assert "You are not allowed to do this." in str(exc.value) assert "You are not allowed to do this." in str(exc.value)
rec_retrieve = db.Record(id=rec.id).retrieve() rec_retrieve = db.Record(id=rec.id).retrieve()
assert rec_retrieve.state is None assert rec_retrieve.state is None
...@@ -757,13 +757,15 @@ def test_unauthorized_initial(): ...@@ -757,13 +757,15 @@ def test_unauthorized_initial():
rec_update.update_acl() rec_update.update_acl()
switch_to_test_user("team-leader") switch_to_test_user("team-leader")
rec.update(sync = False) rec.update(sync=False)
assert rec.state == db.State(model="Model1", name="State1") assert rec.state == db.State(model="Model1", name="State1")
rec_retrieve = db.Record(id=rec.id).retrieve() rec_retrieve = db.Record(id=rec.id).retrieve()
assert rec_retrieve.state == db.State(model="Model1", name="State1") assert rec_retrieve.state == db.State(model="Model1", name="State1")
@pytest.mark.xfail(reason="This is a very special corner case bug with low severity")
@pytest.mark.xfail(
reason="This is a very special corner case bug with low severity")
def test_transitions_included_after_empty_update(): def test_transitions_included_after_empty_update():
rec = db.Record() rec = db.Record()
rec.description = "old description" rec.description = "old description"
...@@ -787,7 +789,6 @@ def test_transitions_included_after_empty_update(): ...@@ -787,7 +789,6 @@ def test_transitions_included_after_empty_update():
from_state="State2", from_state="State2",
to_state="State2")} to_state="State2")}
rec_update_2 = rec_update.update(sync=False) rec_update_2 = rec_update.update(sync=False)
# this fails # this fails
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment