Bug 811014 - Ensure forceIssuer parameter is passed through. r=benadida

This commit is contained in:
Jed Parsons 2012-11-18 00:02:13 -05:00
parent eaee0787d8
commit 2bb3eca524
3 changed files with 41 additions and 1 deletions

View File

@ -206,6 +206,7 @@ function test_options_pass_through() {
let randomMixedParams = {
loggedInUser: "juanita@mozilla.com",
forceAuthentication: true,
issuer: "https://foo.com",
someThing: {
name: "Pertelote",
legs: 4,

View File

@ -80,6 +80,25 @@ function test_request_forceAuthentication() {
MinimalIDService.RP.request(mockedDoc.id, {forceAuthentication: true});
}
/*
* Test that the issuer can be forced
*/
function test_request_forceIssuer() {
do_test_pending();
let mockedDoc = mock_doc(null, TEST_URL);
makeObserver("identity-controller-request", function (aSubject, aTopic, aData) {
do_check_eq(aSubject.wrappedJSObject.id, mockedDoc.id);
do_check_eq(aSubject.wrappedJSObject.origin, TEST_URL);
do_check_eq(aSubject.wrappedJSObject.issuer, "https://jed.gov");
do_test_finished();
run_next_test();
});
MinimalIDService.RP.watch(mockedDoc);
MinimalIDService.RP.request(mockedDoc.id, {issuer: "https://jed.gov"});
}
/*
* Test that the "identity-controller-logout" signal is emitted correctly
*/
@ -103,6 +122,7 @@ let TESTS = [
test_watch,
test_request,
test_request_forceAuthentication,
test_request_forceIssuer,
test_logout
];

View File

@ -166,7 +166,6 @@ function test_request_forceAuthentication() {
RelyingParty.watch(mockedDoc);
makeObserver("identity-request", function(aSubject, aTopic, aData) {
dump("teh obj is " + JSON.stringify(aSubject.wrappedJSObject) + "\n");
do_check_eq(aSubject.wrappedJSObject.rpId, mockedDoc.id);
do_check_eq(aSubject.wrappedJSObject.forceAuthentication, true);
do_test_finished();
@ -176,6 +175,25 @@ function test_request_forceAuthentication() {
RelyingParty.request(mockedDoc.id, {forceAuthentication: true});
}
/*
* ensure the issuer can be forced
*/
function test_request_forceIssuer() {
do_test_pending();
let mockedDoc = mock_doc(null, TEST_URL, function(action, params) {});
RelyingParty.watch(mockedDoc);
makeObserver("identity-request", function(aSubject, aTopic, aData) {
do_check_eq(aSubject.wrappedJSObject.rpId, mockedDoc.id);
do_check_eq(aSubject.wrappedJSObject.issuer, "https://ozten.co.uk");
do_test_finished();
run_next_test();
});
RelyingParty.request(mockedDoc.id, {issuer: "https://ozten.co.uk"});
}
function test_logout() {
do_test_pending();
@ -226,6 +244,7 @@ let TESTS = [
test_watch_notloggedin_logout,
test_request,
test_request_forceAuthentication,
test_request_forceIssuer,
test_logout
];