@@ -25,7 +25,7 @@ def remove_themerr_db_cache_file():
2525def test_home (test_client ):
2626 """
2727 WHEN the '/' page is requested (GET)
28- THEN check that the response is valid
28+ THEN check that the response is a redirect
2929
3030 Repeat for '/home'
3131 """
@@ -34,9 +34,27 @@ def test_home(test_client):
3434 except AttributeError :
3535 pytest .skip ("cannot access Plex token/server" )
3636 else :
37- assert response .status_code == 200
37+ assert response .status_code == 302
3838
3939 response = test_client .get ('/home' )
40+ assert response .status_code == 302
41+
42+
43+ def test_home_no_login (test_client_disabled_login ):
44+ """
45+ WHEN the '/' page is requested (GET)
46+ THEN check that the response is valid
47+
48+ Repeat for '/home'
49+ """
50+ try :
51+ response = test_client_disabled_login .get ('/' )
52+ except AttributeError :
53+ pytest .skip ("cannot access Plex token/server" )
54+ else :
55+ assert response .status_code == 200
56+
57+ response = test_client_disabled_login .get ('/home' )
4058 assert response .status_code == 200
4159
4260 assert 'id="section_' in response .data .decode ('utf-8' )
@@ -45,12 +63,25 @@ def test_home(test_client):
4563def test_home_without_cache (remove_themerr_db_cache_file , test_client ):
4664 """
4765 WHEN the '/' page is requested (GET)
48- THEN check that the response is valid
66+ THEN check that the response is a redirect
4967 """
5068 try :
5169 response = test_client .get ('/' )
5270 except AttributeError :
5371 pytest .skip ("cannot access Plex token/server" )
72+ else :
73+ assert response .status_code == 302
74+
75+
76+ def test_home_without_cache_no_login (remove_themerr_db_cache_file , test_client_disabled_login ):
77+ """
78+ WHEN the '/' page is requested (GET)
79+ THEN check that the response is valid
80+ """
81+ try :
82+ response = test_client_disabled_login .get ('/' )
83+ except AttributeError :
84+ pytest .skip ("cannot access Plex token/server" )
5485 else :
5586 assert response .status_code == 200
5687
@@ -68,6 +99,15 @@ def test_image(test_client):
6899 assert response .content_type == 'image/vnd.microsoft.icon'
69100
70101
102+ def test_image_no_login (test_client_disabled_login ):
103+ """
104+ WHEN the '/favicon.ico' file is requested (GET)
105+ THEN check that the response is a redirect
106+ """
107+ response = test_client_disabled_login .get ('favicon.ico' )
108+ assert response .status_code == 302
109+
110+
71111def test_status (test_client ):
72112 """
73113 WHEN the '/status' page is requested (GET)
@@ -76,3 +116,12 @@ def test_status(test_client):
76116 response = test_client .get ('/status' )
77117 assert response .status_code == 200
78118 assert response .content_type == 'application/json'
119+
120+
121+ def test_status_no_login (test_client_disabled_login ):
122+ """
123+ WHEN the '/status' page is requested (GET)
124+ THEN check that the response is a redirect
125+ """
126+ response = test_client_disabled_login .get ('/status' )
127+ assert response .status_code == 302
0 commit comments