A view method uses plone.api.user.get_roles. The robot test throws a plone.api.user.UserNotFoundError, so roles are not as expected.
[update]
There is a difference between
api.user.get_roles()
and
api.user.get_current().getRoles()
Robot tests fail on getMemberById(username) in get_roles because plone.app.robotframework uses for keyword "Enable autologin as" DomainAuthHelper. Would it be better to use another authentication in plone.app.robotframwork or what do I miss to understand the situation?
You are doing nothing wrong, but the documentation is missing example to map auto login to real users.
The following examples should work:
Enable autologin as Manager
Create user my-test-user Member fullname=Jane Doe
Set autologin username my-test-user
Or
Enable autologin as Manager
Create user my-test-user Member Editor fullname=Jane Doe
Set autologin username my-test-user
At first, Manager is required for creating a real user. Then the real use is created with some roles. Finally, autologin is reconfigured to map to real user (instead of just roles).
I'm interested in using plone.app.robotframeworks for Plone 5. And if I do get it right Plone 5 selectors are not completely supported. And also found a bug in keyword for creating user with roles. Before I dive deeper into robot tests I would be happy about some feedback on https://github.com/plone/plone.app.robotframework/issues/45
Thank you all
@ksuess Could you please tell more about the issue? The library was supposed to support multiple roles. Are you sure you separated roles with two spaces?
Create user janedoe roles=Contributor,Site Administrator
or something like this does not hand over roles to portal_registration.addMember as list, so also here a user without the roles Contributer and Site Administrator is created.