stages/user_write: add test that attributes without prefix are ignored

This commit is contained in:
Jens Langhammer 2020-12-13 20:38:43 +01:00
parent ecdbc917a5
commit 977d3f6ef9
1 changed files with 2 additions and 0 deletions

View File

@ -87,6 +87,7 @@ class TestUserWriteStage(TestCase):
"username": "test-user-new", "username": "test-user-new",
"password": new_password, "password": new_password,
"attribute_some-custom-attribute": "test", "attribute_some-custom-attribute": "test",
"some_ignored_attribute": "bar"
} }
session = self.client.session session = self.client.session
session[SESSION_KEY_PLAN] = plan session[SESSION_KEY_PLAN] = plan
@ -109,6 +110,7 @@ class TestUserWriteStage(TestCase):
self.assertTrue(user_qs.exists()) self.assertTrue(user_qs.exists())
self.assertTrue(user_qs.first().check_password(new_password)) self.assertTrue(user_qs.first().check_password(new_password))
self.assertEqual(user_qs.first().attributes["some-custom-attribute"], "test") self.assertEqual(user_qs.first().attributes["some-custom-attribute"], "test")
self.assertNotIn("some_ignored_attribute", user_qs.first().attributes)
@patch( @patch(
"authentik.flows.views.to_stage_response", "authentik.flows.views.to_stage_response",