@@ -1896,6 +1896,7 @@ def test_metrics(self):
18961896
18971897 def test_education_create_project (self ):
18981898 self .od .delete_all_content ()
1899+ self .od .projects .delete_all ()
18991900
19001901 # prj creation
19011902 id = self .od .projects .create ("prj-name" , "prj-desc" )
@@ -1909,8 +1910,32 @@ def test_education_create_project(self):
19091910 all = self .od .projects .get_all ()
19101911 self .assertEqual (len (all ), 1 )
19111912
1913+ # check the project deletion
1914+ self .od .projects .delete (id )
1915+ all = self .od .projects .get_all ()
1916+ self .assertEqual (len (all ), 0 )
1917+
1918+ def test_education_delete_all_projects (self ):
1919+ self .od .delete_all_content ()
1920+ self .od .projects .delete_all ()
1921+
1922+ # prj creation
1923+ self .od .projects .create ("prj-name" , "prj-desc" )
1924+ self .od .projects .create ("prj-name2" , "prj-desc2" )
1925+
1926+ # check that there are 2 projects
1927+ all = self .od .projects .get_all ()
1928+ self .assertEqual (len (all ), 2 )
1929+
1930+ # check the project deletion
1931+ self .od .projects .delete_all ()
1932+ all = self .od .projects .get_all ()
1933+ self .assertEqual (len (all ), 0 )
1934+
19121935 def test_education_upload (self ):
19131936 self .od .delete_all_content ()
1937+ self .od .images .delete_all ()
1938+ self .od .projects .delete_all ()
19141939
19151940 # upload 1 image
19161941 upload_id = self .od .images .upload_and_dicomize (file_path = here / "stimuli/education.jpeg" , description = "upload-desc" )
@@ -1953,6 +1978,36 @@ def test_education_change_title(self):
19531978 images = self .od .images .get_series_without_a_project ()
19541979 self .assertEqual (images [0 ].title , "new-title" )
19551980
1981+ def test_education_set_viewer (self ):
1982+ self .od .delete_all_content ()
1983+ self .od .projects .delete_all ()
1984+
1985+ # prj creation
1986+ id = self .od .projects .create ("prj-name" , "prj-desc" )
1987+ prj = self .od .projects .get (id )
1988+
1989+ self .assertEqual (prj .primary_viewer .description , "stone" )
1990+
1991+ self .od .projects .set_viewer (id , "volview" )
1992+ prj = self .od .projects .get (id )
1993+ self .assertEqual (prj .primary_viewer .description , "volview" )
1994+
1995+ def test_token_renewal (self ):
1996+ self .od .delete_all_content ()
1997+ self .od .projects .delete_all ()
1998+
1999+ # put an expired token in the client
2000+ expired_token = "ZeyJhbGciOiJSUzI1NiIsImtpZCI6IjNhMjQzYWRhLTVhM2MtNDA0Mi04NmQ5LWFhZjBjM2ZiNzM3MCIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3ODI0ODYyNDgsImlhdCI6MTc4MjQ4MjY0OCwiaWQiOiJ0ZXN0IiwiaW5zdHJ1Y3Rvcl9vZiI6W10sImxlYXJuZXJfb2YiOltdLCJyb2xlIjoiYWRtaW4ifQ.L2DYuuNtHXnnhb6D7guT9t36b4pK-MTvk74UyoRsfHSqzFaikPEJZz6oM2Y2xkTqqwm_oOcjX_P683-s_MFAVycP-G3Fijfcz-hri-1_ewIMPd2mWGqg-jaXFDJBKD5Wo-Ws8rmWPweCu1VQ89dp6sYvPLKuJXCwaug5VFmGlP86lH6Cj4XuvFH9ncV1ynQzakEUAmoahL9H56QrrpXlD8J9TuoScPLqpxtAydFccL8r10Ysiyr-QWB4123BJUGo9jlpxYS29tpiswLbj94L8RX4vU5kjJu1ehn9jNJzNulPyarpaPHlBULJcQn8jyezqqQUuP1UbF5t09qszIZkEw"
2001+ expired_headers = {
2002+ "Authorization" : f"Bearer { expired_token } "
2003+ }
2004+ self .od ._http_session .headers .update (expired_headers )
2005+
2006+ id = self .od .projects .create ("prj-name" , "prj-desc" )
2007+ prj = self .od .projects .get (id )
2008+
2009+ # check prj creation
2010+ self .assertEqual (prj .name , "prj-name" )
19562011
19572012 def test_pool_maxsize (self ):
19582013
0 commit comments