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

TST: add test for password policy error

parent cf9df575
No related branches found
No related tags found
1 merge request!36Tests for user name requirements
Pipeline #25148 passed
......@@ -306,6 +306,15 @@ def test_insert_user_success():
entity=None)
def test_insert_user_failure_password_invalid():
with raises(HTTPClientError) as cm:
admin._insert_user(
name=test_user + "2",
password="1234")
assert cm.value.status == 400
assert cm.value.msg[:70] == "The password does not comply with the current policies for passwords: "
def test_insert_user_failure_permissions():
switch_to_normal_user()
with raises(HTTPForbiddenError) as cm:
......
......@@ -353,6 +353,33 @@ def test_query_with_back_reference():
rec.id)
@mark.xfail(reason="Enhancement proposed")
def test_obligatory_name():
name_prop = db.Property(name="name").retrieve()
rt = db.RecordType(name="TestType").add_property(name_prop, importance=db.OBLIGATORY).insert()
print(rt)
rt = db.RecordType(name="TestType").retrieve()
print(rt)
rec = db.Record(description="TestDesc").add_parent("TestType")
with raises(db.TransactionError) as err:
rec.insert()
assert err.value.has_error(db.EntityError)
assert rec.get_errors()[0].description == "An obligatory property is missing."
rec.name = "TestRec"
rec.insert() # this should work
rec.add_property("name", value="TestRec")
rec.insert()
print(rec)
assert rt is None
name_prop = db.Property(name="name").retrieve()
rt = db.RecordType(name="TestType").add_property(name_prop, importance=db.OBLIGATORY).insert()
rec = db.Record(description="TestDesc").add_parent(
"TestType").add_property("name", value="TestRec").insert()
@mark.xfail(reason="Enhancement proposed")
def test_name_resource():
name_prop = db.Property(name="name").retrieve()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment