Open mzratio opened 8 years ago
This is an excellent feature request. For most tests, we want to generate a uid for each user that is "opaque" - generally it's not a best practice to compare it to a constant value EXCEPT for the case where you are generating custom tokens.
I would just modify your suggestion to require that you explicitly set the uid for the "queue_manager" user rather than set the uid to the name of the passed-in user. Also, I'd rather not repeat custom auth token fields each time it is used in an as()
statement. I would suggest either the first as()
statement allows for additional properties (and uid) to be set while adding additional properties to subsequent as()
statements would be an error).
Alternatively, we could add a add a new method to define custom auth tokens.
defineToken('queue_manager', {uid: 'queue_manager'})
Mike, I do agree with you that it is not a best practice to compare the uid against a constant value. I indeed generate custom tokens on my server.
I have a fork of your repository where I tried out an implementation of my requirements (that works great for what I need). I'll play around with your suggestions (I particularly like the idea of defineToken()) in the next couple of days and let you know what I find out.
Thanks, Michele
Thanks, Michele.
I'd be happy to accept a PR along these lines if you implement this!
I have a couple of requirement that I believe are not supported by Bolt's testing module yet. This is an example of rules I’d like to be able to test:
Basically I need:
The kind of tests I’d like to write would look like the example below:
Is this kind of requirements something you're planning to support soon?
Thanks a lot, Michele