I'm looking for some help. It is already several days I've looked for solution without any success.
I need to launch load test with locust on my nextcloud webpages. I have been able to login and load the "/" page successfully.
I failed to load other pages as "/apps/dashboard/", "/apps/deck/" or "/logout", and I receive the error message '401 Client Error:unauthorized for url: /apps/dashboard'
So it seems I'm logging out before I can load "/apps/dashboard"
Below is my code
import time
from locust import HttpUser, task, between
class StartUserBehavior(HttpUser):
def on_start(self):
self.login()
def login(self):
response = self.client.post('/login', json={'username':'admin', 'password':'adminpasswd'})
if response.status_code == 200:
print('[+]Connection succeeded')
else:
print('[-]Connection failed')
print('[-]Error :', response.status_code)
def on_stop(self):
response = self.client.get('/logout')
if response.status_code == 200:
print('[+]Disconnection succeeded')
else:
print('[-]Disconnection failed')
print('[-]Error :', response.status_code)
@task
def view_pages(self):
self.client.get('/')
time.sleep(5)
result = self.client.get('/apps/dashboard')
time.sleep(5)
some check I made:
- The webpages are correct
- I am logged as administrator
- I can login with success
- I received a 401 error for all pages except "/login" and "/" which are freely accessible.
Any help would be appreciated