✨(documents) add content field as an S3 object
The content field is a writable property on the model which is persisted in object storage. We take advantage of the versioning, robustness and scalability of S3.
This commit is contained in:
committed by
Anthony LC
parent
4956beb040
commit
8e262da8f5
@@ -28,6 +28,7 @@ def test_api_documents_retrieve_anonymous_public():
|
||||
"accesses": [],
|
||||
"title": document.title,
|
||||
"is_public": True,
|
||||
"content": {"foo": document.content["foo"]},
|
||||
}
|
||||
|
||||
|
||||
@@ -69,6 +70,7 @@ def test_api_documents_retrieve_authenticated_unrelated_public():
|
||||
"accesses": [],
|
||||
"title": document.title,
|
||||
"is_public": True,
|
||||
"content": {"foo": document.content["foo"]},
|
||||
}
|
||||
|
||||
|
||||
@@ -132,6 +134,7 @@ def test_api_documents_retrieve_authenticated_related_direct():
|
||||
assert response.json() == {
|
||||
"id": str(document.id),
|
||||
"title": document.title,
|
||||
"content": {"foo": document.content["foo"]},
|
||||
"abilities": document.get_abilities(user),
|
||||
"is_public": document.is_public,
|
||||
}
|
||||
@@ -246,6 +249,7 @@ def test_api_documents_retrieve_authenticated_related_team_members(
|
||||
assert response.json() == {
|
||||
"id": str(document.id),
|
||||
"title": document.title,
|
||||
"content": {"foo": document.content["foo"]},
|
||||
"abilities": document.get_abilities(user),
|
||||
"is_public": False,
|
||||
}
|
||||
@@ -343,6 +347,7 @@ def test_api_documents_retrieve_authenticated_related_team_administrators(
|
||||
assert response.json() == {
|
||||
"id": str(document.id),
|
||||
"title": document.title,
|
||||
"content": {"foo": document.content["foo"]},
|
||||
"abilities": document.get_abilities(user),
|
||||
"is_public": False,
|
||||
}
|
||||
@@ -444,6 +449,7 @@ def test_api_documents_retrieve_authenticated_related_team_owners(
|
||||
assert response.json() == {
|
||||
"id": str(document.id),
|
||||
"title": document.title,
|
||||
"content": {"foo": document.content["foo"]},
|
||||
"abilities": document.get_abilities(user),
|
||||
"is_public": False,
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import random
|
||||
import pytest
|
||||
from rest_framework.test import APIClient
|
||||
|
||||
from core import factories
|
||||
from core import factories, models
|
||||
from core.api import serializers
|
||||
from core.tests.conftest import TEAM, USER, VIA
|
||||
|
||||
@@ -138,7 +138,7 @@ def test_api_documents_update_authenticated_administrator_or_owner(
|
||||
)
|
||||
assert response.status_code == 200
|
||||
|
||||
document.refresh_from_db()
|
||||
document = models.Document.objects.get(pk=document.pk)
|
||||
document_values = serializers.DocumentSerializer(instance=document).data
|
||||
for key, value in document_values.items():
|
||||
if key in ["id", "accesses"]:
|
||||
@@ -175,7 +175,7 @@ def test_api_documents_update_authenticated_owners(via, mock_user_get_teams):
|
||||
)
|
||||
|
||||
assert response.status_code == 200
|
||||
document.refresh_from_db()
|
||||
document = models.Document.objects.get(pk=document.pk)
|
||||
document_values = serializers.DocumentSerializer(instance=document).data
|
||||
for key, value in document_values.items():
|
||||
if key in ["id", "accesses"]:
|
||||
|
||||
Reference in New Issue
Block a user