✅(e2e) change accounts to facilitate SIRET and add e2e test
We also add registration ID info to the /me endpoint, via serializers
This commit is contained in:
committed by
Laurent Bossavit
parent
2435a59078
commit
8fd55a61c5
@@ -88,8 +88,8 @@ class UserOrganizationSerializer(serializers.ModelSerializer):
|
||||
|
||||
class Meta:
|
||||
model = models.Organization
|
||||
fields = ["id", "name"]
|
||||
read_only_fields = ["id", "name"]
|
||||
fields = ["id", "name", "registration_id_list"]
|
||||
read_only_fields = ["id", "name", "registration_id_list"]
|
||||
|
||||
|
||||
class UserSerializer(DynamicFieldsModelSerializer):
|
||||
|
||||
@@ -4,6 +4,7 @@ Test users API endpoints in the People core app: focus on "list" action
|
||||
|
||||
from unittest import mock
|
||||
|
||||
import jq
|
||||
import pytest
|
||||
from rest_framework.status import (
|
||||
HTTP_200_OK,
|
||||
@@ -77,7 +78,13 @@ def test_api_users_list_authenticated_response_content(
|
||||
response = client.get("/api/v1.0/users/")
|
||||
|
||||
assert response.status_code == HTTP_200_OK
|
||||
assert response.json() == {
|
||||
json = response.json()
|
||||
edited_json = (
|
||||
jq.compile(".results[] |= (.organization |= del(.registration_id_list))")
|
||||
.input(json)
|
||||
.first()
|
||||
)
|
||||
assert edited_json == {
|
||||
"count": 2,
|
||||
"next": None,
|
||||
"previous": None,
|
||||
@@ -155,7 +162,13 @@ def test_api_users_authenticated_list_by_email():
|
||||
response = client.get("/api/v1.0/users/?q=ool")
|
||||
|
||||
assert response.status_code == HTTP_200_OK
|
||||
assert response.json()["results"] == [
|
||||
json = response.json()
|
||||
edited_json = (
|
||||
jq.compile(".results[] |= (.organization |= del(.registration_id_list))")
|
||||
.input(json)
|
||||
.first()
|
||||
)
|
||||
assert edited_json["results"] == [
|
||||
{
|
||||
"id": str(frank.id),
|
||||
"email": frank.email,
|
||||
@@ -228,7 +241,13 @@ def test_api_users_authenticated_list_by_name():
|
||||
response = client.get("/api/v1.0/users/?q=oole")
|
||||
|
||||
assert response.status_code == HTTP_200_OK
|
||||
assert response.json()["results"] == [
|
||||
json = response.json()
|
||||
edited_json = (
|
||||
jq.compile(".results[] |= (.organization |= del(.registration_id_list))")
|
||||
.input(json)
|
||||
.first()
|
||||
)
|
||||
assert edited_json["results"] == [
|
||||
{
|
||||
"id": str(frank.id),
|
||||
"email": frank.email,
|
||||
|
||||
@@ -61,6 +61,7 @@ def test_api_users_retrieve_me_authenticated():
|
||||
"organization": {
|
||||
"id": str(user.organization.pk),
|
||||
"name": user.organization.name,
|
||||
"registration_id_list": user.organization.registration_id_list,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user