Comparison

spec/util_sasl_spec.lua @ 10502:f1c0aa521dd5

util.sasl: Add stub tests Random uncommitted file I found when cleaning out my work dir
author Kim Alvefur <zash@zash.se>
date Sat, 14 Dec 2019 22:43:12 +0100
child 13113:191fe4866e3e
comparison
equal deleted inserted replaced
10501:e8186aba1583 10502:f1c0aa521dd5
1 local sasl = require "util.sasl";
2
3 -- profile * mechanism
4 -- callbacks could use spies instead
5
6 describe("util.sasl", function ()
7 describe("plain_test profile", function ()
8 local profile = {
9 plain_test = function (_, username, password, realm)
10 assert.equals("user", username)
11 assert.equals("pencil", password)
12 assert.equals("sasl.test", realm)
13 return true, true;
14 end;
15 };
16 it("works with PLAIN", function ()
17 local plain = sasl.new("sasl.test", profile);
18 assert.truthy(plain:select("PLAIN"));
19 assert.truthy(plain:process("\000user\000pencil"));
20 assert.equals("user", plain.username);
21 end);
22 end);
23
24 describe("plain profile", function ()
25 local profile = {
26 plain = function (_, username, realm)
27 assert.equals("user", username)
28 assert.equals("sasl.test", realm)
29 return "pencil", true;
30 end;
31 };
32
33 it("works with PLAIN", function ()
34 local plain = sasl.new("sasl.test", profile);
35 assert.truthy(plain:select("PLAIN"));
36 assert.truthy(plain:process("\000user\000pencil"));
37 assert.equals("user", plain.username);
38 end);
39
40 -- TODO SCRAM
41 end);
42 end);
43