1616from core import factories
1717from core .api .serializers import ServerCreateDocumentSerializer
1818from core .models import Document , Invitation , User
19+ from core .services import mime_types
1920from core .services .converter_services import ConversionError , YdocConverter
2021
2122pytestmark = pytest .mark .django_db
@@ -191,7 +192,9 @@ def test_api_documents_create_for_owner_existing(mock_convert_md):
191192
192193 assert response .status_code == 201
193194
194- mock_convert_md .assert_called_once_with ("Document content" )
195+ mock_convert_md .assert_called_once_with (
196+ "Document content" , mime_types .MARKDOWN , mime_types .YJS
197+ )
195198
196199 document = Document .objects .get ()
197200 assert response .json () == {"id" : str (document .id )}
@@ -236,7 +239,9 @@ def test_api_documents_create_for_owner_new_user(mock_convert_md):
236239
237240 assert response .status_code == 201
238241
239- mock_convert_md .assert_called_once_with ("Document content" )
242+ mock_convert_md .assert_called_once_with (
243+ "Document content" , mime_types .MARKDOWN , mime_types .YJS
244+ )
240245
241246 document = Document .objects .get ()
242247 assert response .json () == {"id" : str (document .id )}
@@ -297,7 +302,9 @@ def test_api_documents_create_for_owner_existing_user_email_no_sub_with_fallback
297302
298303 assert response .status_code == 201
299304
300- mock_convert_md .assert_called_once_with ("Document content" )
305+ mock_convert_md .assert_called_once_with (
306+ "Document content" , mime_types .MARKDOWN , mime_types .YJS
307+ )
301308
302309 document = Document .objects .get ()
303310 assert response .json () == {"id" : str (document .id )}
@@ -393,7 +400,9 @@ def test_api_documents_create_for_owner_new_user_no_sub_no_fallback_allow_duplic
393400 HTTP_AUTHORIZATION = "Bearer DummyToken" ,
394401 )
395402 assert response .status_code == 201
396- mock_convert_md .assert_called_once_with ("Document content" )
403+ mock_convert_md .assert_called_once_with (
404+ "Document content" , mime_types .MARKDOWN , mime_types .YJS
405+ )
397406
398407 document = Document .objects .get ()
399408 assert response .json () == {"id" : str (document .id )}
@@ -474,7 +483,9 @@ def test_api_documents_create_for_owner_with_default_language(
474483 )
475484 assert response .status_code == 201
476485
477- mock_convert_md .assert_called_once_with ("Document content" )
486+ mock_convert_md .assert_called_once_with (
487+ "Document content" , mime_types .MARKDOWN , mime_types .YJS
488+ )
478489 assert mock_send .call_args [0 ][3 ] == "de-de"
479490
480491
@@ -501,7 +512,9 @@ def test_api_documents_create_for_owner_with_custom_language(mock_convert_md):
501512
502513 assert response .status_code == 201
503514
504- mock_convert_md .assert_called_once_with ("Document content" )
515+ mock_convert_md .assert_called_once_with (
516+ "Document content" , mime_types .MARKDOWN , mime_types .YJS
517+ )
505518
506519 assert len (mail .outbox ) == 1
507520 email = mail .outbox [0 ]
@@ -537,7 +550,9 @@ def test_api_documents_create_for_owner_with_custom_subject_and_message(
537550
538551 assert response .status_code == 201
539552
540- mock_convert_md .assert_called_once_with ("Document content" )
553+ mock_convert_md .assert_called_once_with (
554+ "Document content" , mime_types .MARKDOWN , mime_types .YJS
555+ )
541556
542557 assert len (mail .outbox ) == 1
543558 email = mail .outbox [0 ]
@@ -571,7 +586,9 @@ def test_api_documents_create_for_owner_with_converter_exception(
571586 format = "json" ,
572587 HTTP_AUTHORIZATION = "Bearer DummyToken" ,
573588 )
574- mock_convert_md .assert_called_once_with ("Document content" )
589+ mock_convert_md .assert_called_once_with (
590+ "Document content" , mime_types .MARKDOWN , mime_types .YJS
591+ )
575592
576593 assert response .status_code == 400
577594 assert response .json () == {"content" : ["Could not convert content" ]}
0 commit comments