Bug 811014 - Ensure forceIssuer parameter is passed through. r=benadida
authorJed Parsons <jparsons@mozilla.com>
Sun, 18 Nov 2012 00:02:13 -0500
changeset 113639 9a33aa064e10f65547d01859bd10dae7a8d00eed
parent 113638 52544e3338996ff9085d0c4cd91041688269924e
child 113640 b3b972e271a7b2635f80b73447ce0d1f9cd2d2d2
push id23880
push userryanvm@gmail.com
push dateSun, 18 Nov 2012 13:36:46 +0000
treeherdermozilla-central@174440fca7da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbenadida
bugs811014
milestone19.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 811014 - Ensure forceIssuer parameter is passed through. r=benadida
b2g/components/test/unit/test_signintowebsite.js
toolkit/identity/tests/unit/test_minimalidentity.js
toolkit/identity/tests/unit/test_relying_party.js
--- a/b2g/components/test/unit/test_signintowebsite.js
+++ b/b2g/components/test/unit/test_signintowebsite.js
@@ -201,16 +201,17 @@ function test_request_login_logout() {
 function test_options_pass_through() {
   do_test_pending();
 
   // An meaningless structure for testing that RP messages preserve
   // objects and their parameters as they are passed back and forth.
   let randomMixedParams = {
     loggedInUser: "juanita@mozilla.com",
     forceAuthentication: true,
+    issuer: "https://foo.com",
     someThing: {
       name: "Pertelote",
       legs: 4,
       nested: {bee: "Eric", remaining: "1/2"}
       }
     };
 
   let mockedDoc = mockDoc(randomMixedParams, function(action, params) {});
--- a/toolkit/identity/tests/unit/test_minimalidentity.js
+++ b/toolkit/identity/tests/unit/test_minimalidentity.js
@@ -76,16 +76,35 @@ function test_request_forceAuthenticatio
     run_next_test();
    });
 
   MinimalIDService.RP.watch(mockedDoc);
   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
  */
 function test_logout() {
   do_test_pending();
 
   let mockedDoc = mock_doc(null, TEST_URL);
   makeObserver("identity-controller-logout", function (aSubject, aTopic, aData) {
     do_check_eq(aSubject.wrappedJSObject.id, mockedDoc.id);
@@ -98,16 +117,17 @@ function test_logout() {
 }
 
 let TESTS = [
   test_overall,
   test_mock_doc,
   test_watch,
   test_request,
   test_request_forceAuthentication,
+  test_request_forceIssuer,
   test_logout
 ];
 
 TESTS.forEach(add_test);
 
 function run_test() {
   run_next_test();
 }
--- a/toolkit/identity/tests/unit/test_relying_party.js
+++ b/toolkit/identity/tests/unit/test_relying_party.js
@@ -161,26 +161,44 @@ function test_request() {
 function test_request_forceAuthentication() {
   do_test_pending();
 
   let mockedDoc = mock_doc(null, TEST_URL, function(action, params) {});
 
   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();
     run_next_test();
   });
 
   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();
 
   resetState();
 
   let id = TEST_USER;
   setup_test_identity(id, TEST_CERT, function() {
     let store = get_idstore();
@@ -221,16 +239,17 @@ function test_logout() {
 let TESTS = [
   test_watch_loggedin_ready,
   test_watch_loggedin_login,
   test_watch_loggedin_logout,
   test_watch_notloggedin_ready,
   test_watch_notloggedin_logout,
   test_request,
   test_request_forceAuthentication,
+  test_request_forceIssuer,
   test_logout
 ];
 
 TESTS.forEach(add_test);
 
 function run_test() {
   run_next_test();
 }