@@ -475,6 +475,56 @@ def test_admin_2_delete_admin_1_content(
475
475
assert response .status_code == status .HTTP_404_NOT_FOUND
476
476
477
477
478
+ def test_display_number_increases (
479
+ client : TestClient ,
480
+ access_token_admin_1 : str ,
481
+ existing_tag_id_in_workspace_1 : int ,
482
+ ) -> None :
483
+ """Test creating and deleting content.
484
+
485
+ Parameters
486
+ ----------
487
+ client
488
+ The test client.
489
+ access_token_admin_1
490
+ The access token for admin user 1.
491
+ existing_tag_id_in_workspace_1
492
+ The ID of the existing tag in workspace 1.
493
+ content_metadata
494
+ The metadata of the content.
495
+ """
496
+
497
+ content_tags = [existing_tag_id_in_workspace_1 ]
498
+ response = client .post (
499
+ "/content" ,
500
+ headers = {"Authorization" : f"Bearer { access_token_admin_1 } " },
501
+ json = {
502
+ "content_metadata" : {},
503
+ "content_tags" : content_tags ,
504
+ "content_text" : "Content text 1" ,
505
+ "content_title" : "Content title 1" ,
506
+ },
507
+ )
508
+ assert response .status_code == status .HTTP_200_OK
509
+ json_response = response .json ()
510
+ display_number = json_response ["display_number" ]
511
+
512
+ response = client .post (
513
+ "/content" ,
514
+ headers = {"Authorization" : f"Bearer { access_token_admin_1 } " },
515
+ json = {
516
+ "content_metadata" : {},
517
+ "content_tags" : content_tags ,
518
+ "content_text" : "Content text 2" ,
519
+ "content_title" : "Content title 2" ,
520
+ },
521
+ )
522
+ assert response .status_code == status .HTTP_200_OK
523
+ json_response = response .json ()
524
+ display_number_2 = json_response ["display_number" ]
525
+ assert display_number_2 == display_number + 1
526
+
527
+
478
528
async def test_convert_record_to_schema () -> None :
479
529
"""Test the conversion of a record to a schema."""
480
530
@@ -487,6 +537,7 @@ async def test_convert_record_to_schema() -> None:
487
537
content_text = "sample text" ,
488
538
content_title = "sample title for content" ,
489
539
created_datetime_utc = datetime .now (timezone .utc ),
540
+ display_number = 2 ,
490
541
is_archived = False ,
491
542
positive_votes = 0 ,
492
543
negative_votes = 0 ,
0 commit comments