def test_mails_editor_removed( self, mock_user_information, mock_search_users, mock_mail): # Removing an editor sends a mail to the removed editor. mock_search_users.side_effect = self.get_mock_remote_user_client_search mock_user_information.side_effect = self.get_mock_remote_user_client_user_information self.questionnaire_draft.add_user(self.user_bob, 'editor') detail_page = SampleDetailPage(self) detail_page.route_kwargs = {'identifier': self.questionnaire_draft.code} detail_page.open(login=True, user=self.user_compiler) detail_page.remove_user(self.user_bob.firstname) call_command('send_notification_mails') self.check_mails(mock_mail, [ { 'to': self.user_bob, 'mail': 'editor_removed' } ])
def test_mails_publisher_removed( self, mock_user_information, mock_search_users, mock_mail): # Removing a publisher sends a mail to the removed publisher and to the # compiler. mock_search_users.side_effect = self.get_mock_remote_user_client_search mock_user_information.side_effect = self.get_mock_remote_user_client_user_information self.questionnaire_reviewed.add_user(self.user_bob, 'publisher') detail_page = SampleDetailPage(self) detail_page.route_kwargs = { 'identifier': self.questionnaire_reviewed.code } detail_page.open(login=True, user=self.user_secretariat) detail_page.remove_user(self.user_bob.firstname) call_command('send_notification_mails') self.check_mails(mock_mail, [ { 'to': self.user_bob, 'mail': 'publisher_removed' }, ])