Skip to content
Snippets Groups Projects
Commit b1cf125e authored by Patrick Barroca's avatar Patrick Barroca :grin:
Browse files

dev #40971 : use real nanook response

parent 709eaee8
Branches
Tags
3 merge requests!2334Master,!2178Dev#40971 pouvoir prendre l email comme identifiant alternatif cctp agglo2b,!2174Dev#40971 pouvoir prendre l email comme identifiant alternatif cctp agglo2b
Pipeline #1601 passed with stage
in 12 minutes and 9 seconds
......@@ -71,18 +71,18 @@ class Class_Webservice_SIGB_Nanook_Service extends Class_WebService_SIGB_Abstrac
'password' => $user->getPassword()];
$xml = $this->httpGet($params);
if ('' != $patronId = $this->_getTagData($xml, 'patronId')) {
$user->setIdSigb($patronId);
return true;
}
if ('PatronPasswordNotSecure' == $this->_getTagData($xml, 'error')) {
$message = $this->_getTagData($xml, 'message');
$pattern = $this->_getTagData($xml, 'pattern');
$message = $this->_getTagData($xml, 'securePasswordLabel');
$pattern = '/' . $this->_getTagData($xml, 'securePasswordPattern') . '/';
throw new Class_WebService_SIGB_Nanook_PatronPasswordNotSecureException($message, $pattern);
}
if ('' != $patronId = $this->_getTagData($xml, 'patronId')) {
$user->setIdSigb($patronId);
return true;
}
return false;
}
......
......@@ -35,10 +35,10 @@ abstract class AuthControllerNanookTestCase extends AbstractControllerTestCase {
->mock()
->whenCalled('open_url')
->with('http://localhost:8080/afi_Nanook/ilsdi/service/AuthenticatePatron/username/name%40server.tld/password/1987')
->answers('<?xml version="1.0" encoding="UTF-8"?><AuthenticatePatron><error>PatronPasswordNotSecure</error>'.
'<message>Le mot de passe doit faire au moins 6 caractères et comporter au moins une lettre et un chiffre</message>'.
'<pattern>/^(?=.*[^0-9])(?=.*[0-9]).{6,}$/</pattern>'.
'</AuthenticatePatron>')
->answers('<?xml version="1.0" encoding="UTF-8"?><AuthenticatePatron><patronId>4</patronId><error>PatronPasswordNotSecure</error>'
. '<securePasswordPattern>^(?=.*[A-Za-z])(?=.*\d).{6,}$</securePasswordPattern>'
. '<securePasswordLabel>Le mot de passe doit comporter au minimum 6 caractères et doit être constitué d\'au moins un chiffre et une lettre</securePasswordLabel>'
. '</AuthenticatePatron>')
->beStrict();
$this->_service = Class_WebService_SIGB_Nanook_Service::newInstance()
......@@ -91,7 +91,7 @@ class AuthControllerWithNanookPostLoginWithMailAndUnsecurePassword
/** @test */
public function pageShouldContainsPasswordExplanation() {
$this->assertXPathContentContains('//p', 'Le mot de passe doit faire au moins');
$this->assertXPathContentContains('//p', 'Le mot de passe doit comporter au minimum 6');
}
......@@ -103,7 +103,7 @@ class AuthControllerWithNanookPostLoginWithMailAndUnsecurePassword
/** @test */
public function formShouldContainsInputPattern() {
$this->assertXPath('//form//input[@type="hidden"][@value="/^(?=.*[^0-9])(?=.*[0-9]).{6,}$/"][@name="pattern"]');
$this->assertXPath('//form//input[@type="hidden"][@value="/^(?=.*[A-Za-z])(?=.*\d).{6,}$/"][@name="pattern"]');
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment