Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Become user in server environment to test cloud code

I'm trying to login a User with User.logIn, because I want to test all my cloud code functions with Mocha and expect.js.

I know I can use the masterkey, but I want to test if my errors are handled correctly when I'm logged in with a wrong user (basically I want to test what happens when the ACL blocks the request).

I've tried logging in with cURL and that works, but then I can't become the user because Parse blocks that through It is not memory-safe to become a user in a server environment.

Is this simply not possible or am I overlooking something?

like image 983
Andre Avatar asked Apr 11 '26 18:04

Andre


1 Answers

It turns out I was overlooking something.

In the changelogs of the JS SDK at V.1.5.0 you can see that Parse added the error message described above. You can bypass that by using Parse.User.enableUnsafeCurrentUser();.

You can also provide the session token in the function options.

like image 91
Andre Avatar answered Apr 17 '26 18:04

Andre