From da8f6025900740684bc81e9a7c22f6a83ed48d79 Mon Sep 17 00:00:00 2001 From: Azul Date: Sat, 4 Aug 2012 16:41:01 +0200 Subject: started implementing a restful signup --- spec/django/signup.js | 2 +- spec/restful/.login.js.swp | Bin 12288 -> 0 bytes spec/restful/.signup.js.swp | Bin 12288 -> 0 bytes spec/restful/signup.js | 37 +++---------------------------------- 4 files changed, 4 insertions(+), 35 deletions(-) delete mode 100644 spec/restful/.login.js.swp delete mode 100644 spec/restful/.signup.js.swp (limited to 'spec') diff --git a/spec/django/signup.js b/spec/django/signup.js index b38778a..08a9b64 100644 --- a/spec/django/signup.js +++ b/spec/django/signup.js @@ -28,7 +28,7 @@ describe("Signup", function() { this.srp.register(); this.expectRequest('register/salt/', "I=user") this.respondXML("5d3055e0acd3ddcfc15"); - expect(callback).toHaveBeenCalledWith("adcd57b4a4a05c2e205b0b7b30014d9ff635d8d8db2f502f08e9b9c132800c44", this.srp.registered_user); + expect(callback).toHaveBeenCalledWith(this.srp, this.srp.registered_user); }); it("identifies after successful registration (INTEGRATION)", function(){ diff --git a/spec/restful/.login.js.swp b/spec/restful/.login.js.swp deleted file mode 100644 index 7a6e842..0000000 Binary files a/spec/restful/.login.js.swp and /dev/null differ diff --git a/spec/restful/.signup.js.swp b/spec/restful/.signup.js.swp deleted file mode 100644 index 686174a..0000000 Binary files a/spec/restful/.signup.js.swp and /dev/null differ diff --git a/spec/restful/signup.js b/spec/restful/signup.js index 26e97b5..b1ed7e8 100644 --- a/spec/restful/signup.js +++ b/spec/restful/signup.js @@ -13,47 +13,16 @@ describe("Signup", function() { expect(typeof this.srp.register).toBe('function'); }); - it("fetches a salt from /register/salt", function(){ - var callback = sinon.spy(); - this.srp.register_receive_salt = callback; - this.srp.register(); - this.expectRequest('register/salt/', "I=user") - this.respondXML("5d3055e0acd3ddcfc15"); - expect(callback.called).toBeTruthy(); - }); - - it("receives the salt from /register/salt", function(){ - var callback = sinon.spy(); - this.srp.remote.register_send_verifier = callback; - this.srp.register(); - this.expectRequest('register/salt/', "I=user") - this.respondXML("5d3055e0acd3ddcfc15"); - expect(callback).toHaveBeenCalledWith("adcd57b4a4a05c2e205b0b7b30014d9ff635d8d8db2f502f08e9b9c132800c44", this.srp.registered_user); - }); - it("identifies after successful registration (INTEGRATION)", function(){ var callback = sinon.spy(); this.srp.identify = callback; + this.srp.getSalt = function() {return "5d3055e0acd3ddcfc15"}; this.srp.register(); - this.expectRequest('register/salt/', "I=user") - this.respondXML("5d3055e0acd3ddcfc15"); - this.expectRequest('register/user/', "v=adcd57b4a4a05c2e205b0b7b30014d9ff635d8d8db2f502f08e9b9c132800c44"); - this.respondXML(""); + this.expectRequest('users', "user[login]=user&user[password_salt]=5d3055e0acd3ddcfc15&user[password_verifier]=adcd57b4a4a05c2e205b0b7b30014d9ff635d8d8db2f502f08e9b9c132800c44") + this.respondJSON({password_salt: "5d3055e0acd3ddcfc15", login: "user", ok: "true"}); expect(callback).toHaveBeenCalled(); }); - it("identifies after successful registration with JSON (INTEGRATION)", function(){ - var callback = sinon.spy(); - this.srp.identify = callback; - this.srp.register(); - this.expectRequest('register/salt/', "I=user") - this.respondJSON({salt: "5d3055e0acd3ddcfc15"}); - this.expectRequest('register/user/', "v=adcd57b4a4a05c2e205b0b7b30014d9ff635d8d8db2f502f08e9b9c132800c44"); - this.respondJSON({ok: true}); - expect(callback).toHaveBeenCalled(); - }); - - }); -- cgit v1.2.3