def test_crypt_context_to_settings(): from ordr.security import crypt_context_settings_to_string settings = { 'no_prefix': 'should not appear', 'prefix.something': 'left unchanged', 'prefix.schemes': 'adjust list', 'prefix.depreceated': 'do, not, adjust, this, list' } result = crypt_context_settings_to_string(settings, 'prefix.') expected_lines = { '[passlib]', 'something = left unchanged', 'schemes = adjust,list', 'depreceated = do, not, adjust, this, list', } assert set(result.split('\n')) == expected_lines