I initially though this was because we need to apply the @login_required decorator to the /vault and /folder routes in the vault.py
However, I am sure I have them set
So, I am confused.
For the vault test the purpose is """This test should redirect to /auth/login""" for anauthenticated users . I think is working as it should
this is the current def
def test_unauthenticated_route_access(client, test_path):
"""This test should redirect to /auth/login"""
response = client.get(test_path, follow_redirects=True)
# Print response to help debug
print("Post response status code:", response.status_code)
print("Post response headers:", response.headers)
print("Post response data:", response.data)
# Status code for redirect should be 200 after redirect
assert response.status_code == 200
# Flash message of 'You are not logged in.'
assert b"You are not logged in." in response.data
assert response.request.path == "/auth/login"
The extended error is :
----------------------------------------------------------------------------------------- Captured stdout call ----------------------------------
Post response status code: 404
Post response headers: Content-Type: text/html; charset=utf-8
Content-Length: 207
Vary: Cookie
Post response data: b'<!doctype html>\n<html lang=en>\n<title>404 Not Found</title>\n<h1>Not Found</h1>\n<p>The requested URL was not found on the server. If you entered the URL manually please check yo
ur spelling and try again.</p>\n'
So, I am not sure what exactly is needed here
For the folder test, I have tried to modify this test as I ausing a differnt signature instead to go from vault to folder
"/vault/FOLDER_ID/Folder_NAME/Passing Folder"
This is my best guess
def test_folder_route(client, auth):
# Simulate a login
response = auth.login()
with client:
folder_name = "Passing Folder" # Replace with the actual folder name
with client.application.app_context(): # Ensure we are within the application context
folder_id = get_folder_id_from_database(folder_name) # Retrieve folder_id
# response = client.get("/vault/FOLDER_ID/Passing Folder")
response = client.get(f"/vault/{folder_id}/{folder_name}")
print(response)
assert response.status_code == 200
assert b"Fake Name" in response.data
assert b"Fake Username" in response.data
assert b"asdf1234" in response.data
assert b"www.google.com" in response.data
assert b"note" in response.data
I am struggling with these 2 tests. test_folder_route test_unauthenticated_route_access(client, test_path)
short test summary info
I initially though this was because we need to apply the
@login_required
decorator to the /vault and /folder routes in the vault.py However, I am sure I have them set...
So, I am confused. For the vault test the purpose is """This test should redirect to /auth/login""" for anauthenticated users . I think is working as it should this is the current def
The extended error is : ----------------------------------------------------------------------------------------- Captured stdout call ----------------------------------
So, I am not sure what exactly is needed here
For the folder test, I have tried to modify this test as I ausing a differnt signature instead to go from vault to folder "/vault/FOLDER_ID/Folder_NAME/Passing Folder" This is my best guess
But, I am still getting nowhere