Skip to content

Commit

Permalink
add 3 fields default_number, default_structure_level and default_vote…
Browse files Browse the repository at this point in the history
…_weight
  • Loading branch information
r-peschke committed Sep 7, 2023
1 parent 7ce4c19 commit 920b7c4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
6 changes: 6 additions & 0 deletions openslides_backend/action/actions/user/account_json_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ class AccountJsonUpload(JsonUploadMixin, UsernameMixin):
"username",
"gender",
"pronoun",
"default_number",
"default_structure_level",
"default_vote_weight",
"saml_id",
),
},
Expand All @@ -63,6 +66,9 @@ class AccountJsonUpload(JsonUploadMixin, UsernameMixin):
{"property": "username", "type": "string", "is_object": True},
{"property": "gender", "type": "string"},
{"property": "pronoun", "type": "string"},
{"property": "default_number", "type": "string"},
{"property": "default_structure_level", "type": "string"},
{"property": "default_vote_weight", "type": "decimal"},
{"property": "saml_id", "type": "string", "is_object": True},
]
permission = OrganizationManagementLevel.CAN_MANAGE_USERS
Expand Down
2 changes: 1 addition & 1 deletion openslides_backend/action/mixins/import_mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ def validate_instance(self, instance: Dict[str, Any]) -> None:
]
except Exception:
pass
elif type_ == "string":
elif type_ in ("string", "decimal"):
continue
elif type_ == "integer":
try:
Expand Down
9 changes: 9 additions & 0 deletions tests/system/action/user/test_account_json_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ def test_json_upload_simple(self) -> int:
"default_password": "secret",
"is_active": "1",
"is_physical_person": "F",
"default_number": "strange number",
"default_structure_level": "CEO",
"default_vote_weight": "1.000000",
"wrong": 15,
}
],
Expand All @@ -33,6 +36,9 @@ def test_json_upload_simple(self) -> int:
"default_password": {"value": "secret", "info": ImportState.DONE},
"is_active": True,
"is_physical_person": False,
"default_number": "strange number",
"default_structure_level": "CEO",
"default_vote_weight": "1.000000",
},
}
action_worker_id = response.json["results"][0][0].get("id")
Expand Down Expand Up @@ -114,6 +120,9 @@ def test_json_upload_results(self) -> None:
{"property": "username", "type": "string", "is_object": True},
{"property": "gender", "type": "string"},
{"property": "pronoun", "type": "string"},
{"property": "default_number", "type": "string"},
{"property": "default_structure_level", "type": "string"},
{"property": "default_vote_weight", "type": "decimal"},
{"property": "saml_id", "type": "string", "is_object": True},
],
"rows": [
Expand Down

0 comments on commit 920b7c4

Please sign in to comment.