Allow setting frame pixel sizes from frame parameters (Bug#21415)
[emacs.git] / test / automated / sasl-scram-rfc-tests.el
blob46b139b21a72c5ebe8bca94da54685c90aa48aa8
1 ;;; sasl-scram-rfc-tests.el --- tests for SCRAM-SHA-1 -*- lexical-binding: t; -*-
3 ;; Copyright (C) 2014-2015 Free Software Foundation, Inc.
5 ;; Author: Magnus Henoch <magnus.henoch@gmail.com>
7 ;; GNU Emacs is free software: you can redistribute it and/or modify
8 ;; it under the terms of the GNU General Public License as published by
9 ;; the Free Software Foundation, either version 3 of the License, or
10 ;; (at your option) any later version.
12 ;; GNU Emacs is distributed in the hope that it will be useful,
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;; GNU General Public License for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
20 ;;; Commentary:
22 ;; Test cases from RFC 5802.
24 ;;; Code:
26 (require 'sasl)
27 (require 'sasl-scram-rfc)
29 (ert-deftest sasl-scram-sha-1-test ()
30 ;; The following strings are taken from section 5 of RFC 5802.
31 (let ((client
32 (sasl-make-client (sasl-find-mechanism '("SCRAM-SHA-1"))
33 "user"
34 "imap"
35 "localhost"))
36 (data "r=fyko+d2lbbFgONRv9qkxdawL3rfcNHYJY1ZVvWVs7j,s=QSXCR+Q6sek8bf92,i=4096")
37 (c-nonce "fyko+d2lbbFgONRv9qkxdawL")
38 (sasl-read-passphrase
39 (lambda (_prompt) (copy-sequence "pencil"))))
40 (sasl-client-set-property client 'c-nonce c-nonce)
41 (should
42 (equal
43 (sasl-scram-sha-1-client-final-message client (vector nil data))
44 "c=biws,r=fyko+d2lbbFgONRv9qkxdawL3rfcNHYJY1ZVvWVs7j,p=v0X8v3Bz2T0CJGbJQyF0X+HI4Ts="))
46 ;; This should not throw an error:
47 (sasl-scram-sha-1-authenticate-server client (vector nil "v=rmF9pqV8S7suAoZWja4dJRkFsKQ=
48 "))))
50 ;;; sasl-scram-rfc-tests.el ends here