-
Notifications
You must be signed in to change notification settings - Fork 4
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
Implement integration tests #32
Comments
Is there a good way to mock the usage of the dialogs? To me this sounds good. We could run the redundant appliance snapshots and start the integrationt tests with common tasks. |
I hope so :) I think this may be possible using the # test creation of admin
user_actions = MockUser()
user_actions.add_inputbox_answer('admin')
user_actions.add_inputbox_answer('password')
with activate_mock(user_actions):
# run appliance
# check that admin/password exists in database In other words, we would predefine a "screenplay" of the user's actions, then run the appliance tool in which we read the user's reactions to dialogs from the screenplay. |
awesome. |
This is necessary in order to import the dialogs for integration testing. Working on #32
The API uses mocks to simulate user behavior. Working on #32
32/integration-tests now has a prototype API that allows to implement integration tests. Here is an exemplary test: def test_set_admin_realms(self):
# user1 sets admin realms
user1 = ApplianceBehavior()
user1.navigate('privacyIDEA', 'admin realms')
user1.answer_inputbox('super1,super2,super3')
self.simulate_run(user1)
p_config1 = PrivacyIDEAConfig(DEFAULT_CONFIG)
self.assertEqual(p_config1.get_superusers(), ['super1', 'super2', 'super3'])
# user2 sets other admin realms
user2 = ApplianceBehavior()
user2.navigate('privacyIDEA', 'admin realms')
user2.answer_inputbox('nix')\
.check(initial('^super1,super2,super3$'))
self.simulate_run(user2)
p_config2 = PrivacyIDEAConfig(DEFAULT_CONFIG)
self.assertEqual(p_config2.get_superusers(), ["nix"]) I think it's pretty nice so far , although I'm not 100% sure if the |
Looks cool to me. One other question - how would
work. Does it always belong to an
? |
Reading Currently, the |
The API uses mocks to simulate user behavior. Working on #32
The API uses mocks to simulate user behavior. Working on #32
It would be nice to have "integration tests": We could fake user input and actions with mocks and check that the user actions result in the correct configurations.
The text was updated successfully, but these errors were encountered: