|
@@ -424,15 +424,16 @@ describe('TokenAccessController', function() {
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- it('should redirect to v1', function(done) {
|
|
|
|
|
- expect(this.res.redirect.callCount).to.equal(1)
|
|
|
|
|
- expect(
|
|
|
|
|
- this.res.redirect.calledWith(
|
|
|
|
|
- 302,
|
|
|
|
|
- '/sign_in_to_v1?return_to=/123abc'
|
|
|
|
|
- )
|
|
|
|
|
- ).to.equal(true)
|
|
|
|
|
- return done()
|
|
|
|
|
|
|
+ it('should not redirect to v1', function(done) {
|
|
|
|
|
+ expect(this.res.redirect.callCount).to.equal(0)
|
|
|
|
|
+ done()
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ it('should show project import page', function(done) {
|
|
|
|
|
+ expect(this.res.render.calledWith('project/v2-import')).to.equal(
|
|
|
|
|
+ true
|
|
|
|
|
+ )
|
|
|
|
|
+ done()
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
|
|
|
|
@@ -1102,6 +1103,7 @@ describe('TokenAccessController', function() {
|
|
|
this.req = new MockRequest()
|
|
this.req = new MockRequest()
|
|
|
this.res = new MockResponse()
|
|
this.res = new MockResponse()
|
|
|
this.res.redirect = sinon.stub()
|
|
this.res.redirect = sinon.stub()
|
|
|
|
|
+ this.res.render = sinon.stub()
|
|
|
this.next = sinon.stub()
|
|
this.next = sinon.stub()
|
|
|
this.req.params['read_only_token'] = 'abcd'
|
|
this.req.params['read_only_token'] = 'abcd'
|
|
|
this.TokenAccessHandler.findProjectWithReadOnlyToken = sinon
|
|
this.TokenAccessHandler.findProjectWithReadOnlyToken = sinon
|
|
@@ -1110,22 +1112,21 @@ describe('TokenAccessController', function() {
|
|
|
this.TokenAccessHandler.checkV1ProjectExported = sinon
|
|
this.TokenAccessHandler.checkV1ProjectExported = sinon
|
|
|
.stub()
|
|
.stub()
|
|
|
.callsArgWith(1, null, false)
|
|
.callsArgWith(1, null, false)
|
|
|
- return this.TokenAccessController.readOnlyToken(
|
|
|
|
|
|
|
+ this.TokenAccessController.readOnlyToken(
|
|
|
this.req,
|
|
this.req,
|
|
|
this.res,
|
|
this.res,
|
|
|
this.next
|
|
this.next
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- it('should redirect to v1', function(done) {
|
|
|
|
|
- expect(this.res.redirect.callCount).to.equal(1)
|
|
|
|
|
- expect(
|
|
|
|
|
- this.res.redirect.calledWith(
|
|
|
|
|
- 302,
|
|
|
|
|
- '/sign_in_to_v1?return_to=/read/abcd'
|
|
|
|
|
- )
|
|
|
|
|
- ).to.equal(true)
|
|
|
|
|
- return done()
|
|
|
|
|
|
|
+ it('should not redirect to v1', function(done) {
|
|
|
|
|
+ expect(this.res.redirect.callCount).to.equal(0)
|
|
|
|
|
+ done()
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ it('should show project import page', function(done) {
|
|
|
|
|
+ expect(this.res.render.calledWith('project/v2-import')).to.equal(true)
|
|
|
|
|
+ done()
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
|
|
|
|
@@ -1756,22 +1757,24 @@ describe('TokenAccessController', function() {
|
|
|
exists: true,
|
|
exists: true,
|
|
|
exported: false
|
|
exported: false
|
|
|
})
|
|
})
|
|
|
- return this.TokenAccessController.readOnlyToken(
|
|
|
|
|
|
|
+ this.res.render = sinon.stub()
|
|
|
|
|
+ this.TokenAccessController.readOnlyToken(
|
|
|
this.req,
|
|
this.req,
|
|
|
this.res,
|
|
this.res,
|
|
|
this.next
|
|
this.next
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- it('should redirect to v1', function(done) {
|
|
|
|
|
- expect(this.res.redirect.callCount).to.equal(1)
|
|
|
|
|
- expect(
|
|
|
|
|
- this.res.redirect.calledWith(
|
|
|
|
|
- 302,
|
|
|
|
|
- `/sign_in_to_v1?return_to=/read/${this.readOnlyToken}`
|
|
|
|
|
- )
|
|
|
|
|
- ).to.equal(true)
|
|
|
|
|
- return done()
|
|
|
|
|
|
|
+ it('should not redirect to v1', function(done) {
|
|
|
|
|
+ expect(this.res.redirect.callCount).to.equal(0)
|
|
|
|
|
+ done()
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ it('should show project import page', function(done) {
|
|
|
|
|
+ expect(this.res.render.calledWith('project/v2-import')).to.equal(
|
|
|
|
|
+ true
|
|
|
|
|
+ )
|
|
|
|
|
+ done()
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
|
|
|
|
@@ -1810,22 +1813,24 @@ describe('TokenAccessController', function() {
|
|
|
exists: true,
|
|
exists: true,
|
|
|
exported: false
|
|
exported: false
|
|
|
})
|
|
})
|
|
|
- return this.TokenAccessController.readOnlyToken(
|
|
|
|
|
|
|
+ this.res.render = sinon.stub()
|
|
|
|
|
+ this.TokenAccessController.readOnlyToken(
|
|
|
this.req,
|
|
this.req,
|
|
|
this.res,
|
|
this.res,
|
|
|
this.next
|
|
this.next
|
|
|
)
|
|
)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
- it('should redirect to v1', function(done) {
|
|
|
|
|
- expect(this.res.redirect.callCount).to.equal(1)
|
|
|
|
|
- expect(
|
|
|
|
|
- this.res.redirect.calledWith(
|
|
|
|
|
- 302,
|
|
|
|
|
- `/sign_in_to_v1?return_to=/read/${this.readOnlyToken}`
|
|
|
|
|
- )
|
|
|
|
|
- ).to.equal(true)
|
|
|
|
|
- return done()
|
|
|
|
|
|
|
+ it('should not redirect to v1', function(done) {
|
|
|
|
|
+ expect(this.res.redirect.callCount).to.equal(0)
|
|
|
|
|
+ done()
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ it('should show project import page', function(done) {
|
|
|
|
|
+ expect(this.res.render.calledWith('project/v2-import')).to.equal(
|
|
|
|
|
+ true
|
|
|
|
|
+ )
|
|
|
|
|
+ done()
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
|
|
|