Forum OpenACS Development: masquerading as other users

Collapse
Posted by tammy m on
Hi

Yet another question brought on by trying to write unit tests for code. I need to be site admin to run my unit tests. But in my tests, I want to be able to switch between users. I recall there is a way to do this in the UI somewhere.

But when I tried

 ad_user_logout
    ad_user_login $aat_user1
I got logged out as site admin of course and then acs-automated-testing booted me! And then I got sent to the "Security Violation: You don't have permission to read" page. Ok I can handle that. But what's weird is I then got that same Security Violation page for ANY page in the site that I attempted to go to from within the browser. In any other browser I started, I could access the homepage to login again. Not so where I had run the acs-automated-testing unit test that switched users. Is this expected/desired behavior for some reason?

Anyway, what is the preferred way to switch from admin user temporarily during unit tests?

tia

Collapse
Posted by Jade Rubick on
Developer support (the package)
Collapse
Posted by tammy m on
But I'm switching from code within individual unit tests, not the UI. Anyway, I'll grep through developer support code for how they do it. Thanks.