Merge pull request #145 from sharelatex/ho-login-smoke-tests-2

use /dev/csrf for smoke tests
This commit is contained in:
Henry Oswald 2017-11-21 13:08:17 +00:00 committed by GitHub
commit c846f5dcc0

View file

@ -33,17 +33,13 @@ describe "Opening", ->
return done(err)
logger.log "smoke test: clearing rate limit "
require("../../../app/js/infrastructure/RateLimiter.js").clearRateLimit "open-project", "#{Settings.smokeTest.projectId}:#{Settings.smokeTest.userId}", ->
logger.log "smoke test: hitting /login"
logger.log "smoke test: hitting dev/csrf"
command = """
curl -H "X-Forwarded-Proto: https" -c #{cookeFilePath} #{buildUrl('login')}
curl -H "X-Forwarded-Proto: https" -c #{cookeFilePath} #{buildUrl('dev/csrf')}
"""
child.exec command, (err, stdout, stderr)->
if err? then done(err)
csrfMatches = stdout.match("<input name=\"_csrf\" type=\"hidden\" value=\"(.*?)\">")
if !csrfMatches?
logger.err stdout:stdout, "smoke test: does not have csrf token"
return done("smoke test: does not have csrf token")
csrf = csrfMatches[1]
csrf = stdout
logger.log "smoke test: converting cookie file 1"
convertCookieFile (err) ->
return done(err) if err?