WebHare community

Logout in unit test

I’ve made a unit test for an API that can login and check the login status, basically using the auth object from webdesign->GetWRDAuthPlugin().

But I can’t get logout to work:

>  ** UNEXPECTED EXCEPTION: The current script is not running in the context of a dynamic page request (SHTML file)

How would I implement logout functionality in a unit test?

Properly: don’t invoke wrdauth code directly but use a webbrowser so it can actually set and clear cookies as it would do ‘for real’. You can’t properly test the statefulness in any cookie-based authentication mechanism without having a browser that honors the cookies being set.

And if you want to run the code directly, I think you should just recreate the webdesign and get a fresh wrdauthplugin where you’re not logged in - the equivalent of ‘clear all data’.

Got it figured out @wouter?

Yeah, I took the ‘easy’ way out with

you should just recreate the webdesign and get a fresh wrdauthplugin