Skip to content

Commit cbbb966

Browse files
committed
Added tests for PAP authentication protocol
1 parent 694d3fc commit cbbb966

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

Diff for: test/tests.js

+31-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ describe('Pepper', function() {
9696
});
9797

9898

99-
it('Should do a successful "logon" action update clientState', function(done) {
99+
it('Should do a successful "logon" action', function(done) {
100100
var pepper = Pepper({
101101
host: 'localhost',
102102
port: 5000,
@@ -112,6 +112,36 @@ describe('Pepper', function() {
112112
});
113113

114114

115+
it('Should do a successful "logon" action using PAP authentication', function(done) {
116+
var pepper = Pepper({
117+
host: 'localhost',
118+
port: 5000,
119+
ssl: false
120+
});
121+
122+
pepper.logon('test', 'test', { protocol: 'PAP' }, function(err, data) {
123+
expect(data).to.have.property('clientState');
124+
expect(data.clientState).to.equal(1);
125+
expect(pepper.status.clientState).to.equal(1);
126+
done();
127+
});
128+
});
129+
130+
131+
it('Should throw an error if authentication protocol is not valid', function(done) {
132+
var pepper = Pepper({
133+
host: 'localhost',
134+
port: 5000,
135+
ssl: false
136+
});
137+
138+
pepper.logon('test', 'test', { protocol: 'INVALID' }, function(err, data) {
139+
expect(err.message).to.equal('Invalid or unsupported authentication protocol');
140+
done();
141+
});
142+
});
143+
144+
115145
it('Should callback with an error if we try to "logon" twice', function(done) {
116146
var pepper = Pepper({
117147
host: 'localhost',

0 commit comments

Comments
 (0)