@@ -46,3 +46,28 @@ def test_filter_by_created_before(auth_client_with_refresh, create_user, create_
4646 assert response2 .status_code == 200 , "response status code not 200"
4747 sims = response2 .data
4848 assert len (sims ) == 0 , "Length of response list is not 0"
49+
50+ def test_filter_by_created_after (auth_client_with_refresh , create_user , create_simulation_list ):
51+ before_creation = datetime .now ()
52+ before_creation_iso = before_creation .isoformat ()
53+
54+ user = create_user (email = "test1@email.com" ,password = "test1password" )
55+ sim_list = create_simulation_list (user = user )
56+
57+ after_creation = datetime .now ()
58+ after_creation_iso = after_creation .isoformat ()
59+
60+ auth_client , _ = auth_client_with_refresh (user = user , password = "test1password" )
61+
62+ url = reverse ("simulation-list" )
63+ response1 = auth_client .get (url , {"created_after" : before_creation_iso })
64+
65+ assert response1 .status_code == 200 , "response status code not 200"
66+ sims = response1 .data
67+ assert len (sims ) == 5 , "Length of response list is not 5"
68+ assert sims [0 ] == SimulationStatusSerializer (sim_list [0 ]).data , "First Simulation of List response is different from first simulation of list in memory"
69+
70+ response2 = auth_client .get (url , {"created_after" : after_creation_iso })
71+ assert response2 .status_code == 200 , "response status code not 200"
72+ sims = response2 .data
73+ assert len (sims ) == 0 , "Length of response list is not 0"
0 commit comments