summaryrefslogtreecommitdiff
path: root/spec/login_spec.js
diff options
context:
space:
mode:
authorAzul <azul@riseup.net>2015-09-17 19:48:11 +0200
committerAzul <azul@riseup.net>2015-09-17 19:48:11 +0200
commitff0b3facac13513832d05346c5308b6a4a558f2b (patch)
tree799834d01040cf3e817d18412ecc4eaaaf49d507 /spec/login_spec.js
parent8f33d32d40b1e21ae7fb9a92c78a275422af4217 (diff)
parentcae6017d35cf9fb18c944c20d30da4fb330f68ba (diff)
Merge remote-tracking branch 'alster/add-ci' into master
Diffstat (limited to 'spec/login_spec.js')
-rw-r--r--spec/login_spec.js16
1 files changed, 9 insertions, 7 deletions
diff --git a/spec/login_spec.js b/spec/login_spec.js
index 461a4bb..24c7f4f 100644
--- a/spec/login_spec.js
+++ b/spec/login_spec.js
@@ -42,6 +42,10 @@ describe("Login with srp var", function() {
beforeEach(function() {
specHelper.setupFakeXHR.apply(this);
+ calculate = new srp.Calculate();
+ calculate.randomSalt = function() {return "4c78c3f8"};
+ srp.session = new srp.Session(undefined, calculate);
+
A_ = srp.session.calculateAndSetA(data.a)
old_login = $('#srp_username').val();
old_conf = $('#srp_password_confirmation').val();
@@ -68,7 +72,7 @@ describe("Login with srp var", function() {
});
it("authenticates successfully", function(){
- srp.loggedIn = sinon.spy();
+ srp.loggedIn = jasmine.createSpy();
srp.login();
this.expectRequest('/1/sessions.json', 'login=' +data.username+ '&A=' +data.aa, 'POST');
@@ -80,7 +84,7 @@ describe("Login with srp var", function() {
});
it("reports errors during handshake", function(){
- srp.error = sinon.spy();
+ srp.error = jasmine.createSpy();
var error = {login: "something went wrong on the server side"};
srp.login();
@@ -88,14 +92,12 @@ describe("Login with srp var", function() {
this.respondJSON(error, 422);
//this.expectNoMoreRequests();
- expect(srp.error).toHaveBeenCalled;
- var args = srp.error.args[0];
- expect(args[0]).toEqual(error);
+ expect(srp.error).toHaveBeenCalledWith(error);
});
it("rejects B = 0", function(){
- srp.loggedIn = sinon.spy();
- srp.error = sinon.spy();
+ srp.loggedIn = jasmine.createSpy();
+ srp.error = jasmine.createSpy();
srp.login();
this.expectRequest('/1/sessions.json', 'login=' +data.username+ '&A=' +data.aa, 'POST');