Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved functionality for setting userRoles #152

Open
kennsippell opened this issue Dec 18, 2021 · 0 comments
Open

Improved functionality for setting userRoles #152

kennsippell opened this issue Dec 18, 2021 · 0 comments

Comments

@kennsippell
Copy link
Member

kennsippell commented Dec 18, 2021

Is your feature request related to a problem? Please describe.
For tests relying on properly set roles, the re-assignment of the user requires two steps:

harness.user = 'chw';
harness.userRoles = ['chw'];

It would be nice to just set harness.user = 'chw'; and not have to worry about setting two things.

Describe the solution you'd like
Can harness.userRoles be an object which maps the user's contact_type to a default set of roles?

harness.userRoles = {
  chw: ['chw'],
  supervisor: ['supervisor'],
};

Or it could be a function.

@kennsippell kennsippell changed the title Improved functionality for mocking userRoles Improved functionality for setting userRoles Dec 18, 2021
kennsippell added a commit that referenced this issue Jan 3, 2022
1. Adds support for cht-core v3.12
2. New interface harness.userRoles and associated handles in the "defaults file" for setting the current user's assigned role. I think we might want to improve this later Improved functionality for setting userRoles #152, and if reviewer has any immediate suggestions please indicate.
3. Adds version-aware tests cht-core for cht-scripts-api (works >=v3.12 and doesn't work <v3.12)

Refactoring:

Currently tests for tasks/targets are written against a compiled app_settings.json file without the source. That's tough to work with and tough to understand, so this adds a new project with source for unit tests. For now, it keeps the old tests too.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant