diff options
author | Azul <azul@riseup.net> | 2012-11-14 12:28:57 +0100 |
---|---|---|
committer | Azul <azul@riseup.net> | 2012-11-14 12:33:31 +0100 |
commit | 2859af0287d7672df0a8965be43fb9859fca8bf8 (patch) | |
tree | 4be112443f48a29763b6adae5f68d521022dcc55 /spec/django | |
parent | 7b73cbd591aa9ac3f46400c040ae14ec26e2d839 (diff) | |
parent | 47c7a78e948f139074ec8d975cdd38cc3335253d (diff) |
Merge branch 'feature/cleanup-non-restful' into develop
Diffstat (limited to 'spec/django')
-rw-r--r-- | spec/django/login.js | 69 | ||||
-rw-r--r-- | spec/django/signup.js | 50 |
2 files changed, 0 insertions, 119 deletions
diff --git a/spec/django/login.js b/spec/django/login.js deleted file mode 100644 index d13f695..0000000 --- a/spec/django/login.js +++ /dev/null @@ -1,69 +0,0 @@ -describe("Login", function() { - - it("has an identify function", function() { - var srp = new SRP(); - expect(typeof srp.identify).toBe('function'); - }); - - describe("(INTEGRATION)", function (){ - // a valid auth attempt for the user / password given in the spec runner: - var a = 'af141ae6'; - var B = '887005895b1f5528b4e4dfdce914f73e763b96d3c901d2f41d8b8cd26255a75'; - var salt = '5d3055e0acd3ddcfc15'; - var M = 'be6d7db2186d5f6a2c55788479b6eaf75229a7ca0d9e7dc1f886f1970a0e8065' - var M2 = '2547cf26318519090f506ab73a68995a2626b1c948e6f603ef9e1b0b78bf0f7b'; - var A, callback; - - - beforeEach(function() { - var srp = new SRP(); - var session = new srp.Session(); - this.srp = new SRP(null, session) - A = session.calculateAndSetA(a); - - specHelper.setupFakeXHR.apply(this); - - this.srp.success = sinon.spy(); - }); - - afterEach(function() { - this.xhr.restore(); - }); - - it("works with XML responses", function(){ - this.srp.identify(); - - this.expectRequest('handshake/', 'I=user&A='+A); - this.respondXML("<r s='"+salt+"' B='"+B+"' />"); - this.expectRequest('authenticate/', 'M='+M); - this.respondXML("<M>"+M2+"</M>"); - - expect(this.srp.success).toHaveBeenCalled(); - }); - - it("works with JSON responses", function(){ - this.srp.identify(); - - this.expectRequest('handshake/', 'I=user&A='+A); - this.respondJSON({s: salt, B: B}); - this.expectRequest('authenticate/', 'M='+M); - this.respondJSON({M: M2}); - - expect(this.srp.success).toHaveBeenCalled(); - }); - - it("rejects B = 0", function(){ - this.srp.error = sinon.spy(); - this.srp.identify(); - - this.expectRequest('handshake/', 'I=user&A='+A); - this.respondJSON({s: salt, B: 0}); - // aborting if B=0 - expect(this.requests).toEqual([]); - expect(this.srp.error).toHaveBeenCalled(); - }); - }); - - -}); - diff --git a/spec/django/signup.js b/spec/django/signup.js deleted file mode 100644 index 383dd14..0000000 --- a/spec/django/signup.js +++ /dev/null @@ -1,50 +0,0 @@ -describe("Signup", function() { - - beforeEach(function() { - this.srp = new SRP(); - specHelper.setupFakeXHR.apply(this); - }); - - afterEach(function() { - this.xhr.restore(); - }); - - it("has a register function", function() { - expect(typeof this.srp.register).toBe('function'); - }); - - it("receives the salt from /register/salt", function(){ - var callback = sinon.spy(); - this.srp.remote.sendVerifier = callback; - this.srp.register(); - this.expectRequest('register/salt/', "I=user") - this.respondXML("<salt>5d3055e0acd3ddcfc15</salt>"); - expect(callback).toHaveBeenCalledWith(this.srp.session, this.srp.registered_user); - }); - - it("identifies after successful registration (INTEGRATION)", function(){ - var callback = sinon.spy(); - this.srp.identify = callback; - this.srp.register(); - this.expectRequest('register/salt/', "I=user") - this.respondXML("<salt>5d3055e0acd3ddcfc15</salt>"); - this.expectRequest('register/user/', "v=adcd57b4a4a05c2e205b0b7b30014d9ff635d8d8db2f502f08e9b9c132800c44"); - this.respondXML("<ok />"); - 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(); - }); - - -}); - - |