コード例 #1
0
    def test_non_matching_new_passwords_fail(self, mock_api_client):
        conn = mock_api_client.get_connection()

        form = PasswordChangeForm(
            None,
            data={
                'old_password': '******',
                'new_password': '******',
                'new_password_confirmation': 'new2'
            }
        )

        self.assertFalse(form.is_valid())
        self.assertFalse(conn.change_password.post.called)
コード例 #2
0
    def test_change_password(self, mock_api_client):
        conn = mock_api_client.get_connection()

        form = PasswordChangeForm(
            None,
            data={
                'old_password': '******',
                'new_password': '******',
                'new_password_confirmation': 'new'
            }
        )

        self.assertTrue(form.is_valid())
        conn.change_password.post.assert_called_once_with({
            'old_password': '******', 'new_password': '******'
        })