Commit b2e67007 authored by Laurent's avatar Laurent

complete portal autodetect tests

parent f698cf1d
......@@ -68,3 +68,41 @@ export class AutodetectBokeh extends AutodetectScenario {
}
}
export class AutodetectKoha extends AutodetectScenario {
public frontPage():string {
return this._encapsulate('\
<form action="/cgi-bin/koha/opac-user.pl" name="auth" id="auth" method="post">\
</form>');
}
}
export class AutodetectKohaCASUL2 extends AutodetectScenario {
public frontPage():string {
return this._encapsulate('\
<div id="opac-login-page">\
<a href="https://casl2.u2.fr/cas/login?service=https%3A%2F%2Ful.fr%2Fcgi-bin%2Fkoha%2Fopac-user.pl"></a>\
<form action="/cgi-bin/koha/opac-user.pl" name="auth" id="auth" method="post">\
</form>\
</div>');
}
}
export class AutodetectKohaCASUL3 extends AutodetectScenario {
public frontPage():string {
return this._encapsulate('\
<div id="opac-main">\
<a href="https://cas.ul3.fr/cas/login?service=https://ul3.fr//cgi-bin/koha/opac-user.pl">\
</a>\
</div>');
}
}
......@@ -5,7 +5,10 @@ import {Autodetect} from '../../models/portal/autodetect';
import {AutodetectOrpheemedia,
AutodetectPMB,
AutodetectDecalogOpac,
AutodetectBokeh} from './autodetect-fixtures';
AutodetectBokeh,
AutodetectKoha,
AutodetectKohaCASUL2,
AutodetectKohaCASUL3} from './autodetect-fixtures';
describe('Account with autodetect adapter', () => {
let adapter: Autodetect;
......@@ -74,5 +77,46 @@ describe('Account with autodetect adapter', () => {
() => {
expect(account.getAdapterIdentifier()).to.equals('bokeh');
});
});
});
it('should detect Koha', () => {
return adapter
.setHTTP(new AutodetectKoha('http://ulw.fr'))
.refresh(account).then(
() => {
expect.fail('WrongLoginPassword error should be thrown');
},
() => {
expect(account.getAdapterIdentifier()).to.equals('koha');
});
});
it('should detect Koha CAS UL2', () => {
return adapter
.setHTTP(new AutodetectKohaCASUL2('http://ulw.fr'))
.refresh(account).then(
() => {
expect.fail('WrongLoginPassword error should be thrown');
},
() => {
expect(account.getAdapterIdentifier()).to.equals('koha-cas');
});
});
it('should detect Koha CAS UL3', () => {
return adapter
.setHTTP(new AutodetectKohaCASUL3('http://ulw.fr'))
.refresh(account).then(
() => {
expect.fail('WrongLoginPassword error should be thrown');
},
() => {
expect(account.getAdapterIdentifier()).to.equals('koha-cas');
});
});
});
Markdown is supported
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