Search code examples
symfonycassmoke-testingsmoke

Using CAS with redirect Failed asserting that the Response status code is 200


There is an application that worked before including CAS, but now that the CAS performs the redirection, the smoke test does not find where to do the test

we expect a return code of 200 to process, however the actual return code is an error: status code 302

$this->assertResponseStatusCodeSame(expectedCode.200)

============================ TERMINAL MESSAGE
18) App\Tests\SmokeTests\SmokeTest::testConCRUD with data set #17 ('/secure/conv/404496/c...1/edit')
Failed asserting that the Response status code is 200.
HTTP/1.1 302 Found
Cache-Control: max-age=0, must-revalidate, private
Content-Type:  text/html; charset=UTF-8
Date:          Thu, 21 Jul 2022 13:01:33 GMT
Expires:       Thu, 21 Jul 2022 13:01:33 GMT
Location:      https://cas-site-cas-module.cloudapps.mysite.com/cas/login?service=http%3A%2F%2Flocalhost%2Fsecure%2Fconv%2F404496%2Fconv%2F1%2Fprod%2F1%2Fedit
========================================================

the smoke test is successfull using only part 2

PART 1: https://cas-site-cas-module.cloudapps.mysite.com/cas/login?service=

PART 2: http%3A%2F%2Flocalhost%2Fsecure%2Fconvocatoria%2F404496%2Fconv%2F1%2Fprod%2F1%2Fedit


Solution

  • We solve it adding a configuration on security.yaml to bypass the CAS

    when@test:
      security:
        password_hashers:
        ...