def test_enterprise_wrong_user(self): params = get_connected_params() api.query_enterprise(params) cmd = enterprise.EnterpriseUserCommand() with self.assertLogs(level=logging.WARNING): cmd.execute(params, lock=True, email='*****@*****.**')
def test_enterprise_add_user(self): params = get_connected_params() api.query_enterprise(params) cmd = enterprise.EnterpriseUserCommand() TestEnterprise.expected_commands = ['enterprise_user_add'] cmd.execute(params, add=True, email='*****@*****.**') self.assertEqual(len(TestEnterprise.expected_commands), 0)
def test_enterprise_delete_user(self): params = get_connected_params() api.query_enterprise(params) cmd = enterprise.EnterpriseUserCommand() TestEnterprise.expected_commands = ['enterprise_user_delete'] cmd.execute(params, delete=True, force=True, email=ent_env.user2_email) self.assertEqual(len(TestEnterprise.expected_commands), 0)
def test_enterprise_lock_user(self): params = get_connected_params() api.query_enterprise(params) cmd = enterprise.EnterpriseUserCommand() TestEnterprise.expected_commands = ['enterprise_user_lock', 'enterprise_user_lock'] cmd.execute(params, unlock=True, email=[ent_env.user2_email]) cmd.execute(params, lock=True, email=[ent_env.user2_email]) self.assertEqual(len(TestEnterprise.expected_commands), 0)
def test_enterprise_user_team(self): params = get_connected_params() api.query_enterprise(params) cmd = enterprise.EnterpriseUserCommand() TestEnterprise.expected_commands = ['team_enterprise_user_add'] cmd.execute(params, add_team=[ent_env.team2_uid], email=ent_env.user2_email) self.assertEqual(len(TestEnterprise.expected_commands), 0) TestEnterprise.expected_commands = ['team_enterprise_user_remove'] cmd.execute(params, remove_team=[ent_env.team2_uid], email=ent_env.user2_email) self.assertEqual(len(TestEnterprise.expected_commands), 0)
def test_enterprise_user_update(self): params = get_connected_params() api.query_enterprise(params) cmd = enterprise.EnterpriseUserCommand() TestEnterprise.expected_commands = ['enterprise_user_update'] cmd.execute(params, node='Root node', email=[ent_env.user2_email]) self.assertEqual(len(TestEnterprise.expected_commands), 0) TestEnterprise.expected_commands = ['enterprise_user_update'] cmd.execute(params, node='{0}'.format(ent_env.node1_id), email=[ent_env.user2_email]) self.assertEqual(len(TestEnterprise.expected_commands), 0)
def test_enterprise_expire_password(self): params = get_connected_params() api.query_enterprise(params) cmd = enterprise.EnterpriseUserCommand() TestEnterprise.expected_commands = ['set_master_password_expire'] cmd.execute(params, expire=True, force=True, email=ent_env.user2_email) self.assertEqual(len(TestEnterprise.expected_commands), 0) with mock.patch('keepercommander.commands.enterprise.user_choice') as mock_choice: TestEnterprise.expected_commands = ['set_master_password_expire'] mock_choice.return_value = 'y' cmd.execute(params, expire=True, email=ent_env.user2_email) self.assertEqual(len(TestEnterprise.expected_commands), 0) mock_choice.return_value = 'n' cmd.execute(params, expire=True, email=ent_env.user2_email)