Example #1
0
    def test_persona_standard_sign_in(self):
        uitests = UiTests(self.marionette)
        uitests.launch()
        uitests.tap_api_button()
        moz_id = uitests.tap_moz_id_button()
        moz_id.switch_to_frame()

        persona = moz_id.tap_standard_sign_in()

        persona.login(self.user.email, self.user.password)

        moz_id.switch_to_frame()
        moz_id.wait_for_login_event()
        moz_id.tap_logout_button()
        moz_id.wait_for_logout_event()

        assertion = moz_id.get_assertion()
        assertionUtil = AssertionUtil()
        unpacked = assertionUtil.unpackAssertion(assertion)

        self.assertEqual(AUDIENCE, unpacked['payload']['aud'])
        self.assertEqual(self.user.email, unpacked['claim']['principal']['email'])

        verified = assertionUtil.verifyAssertion(assertion, AUDIENCE, VERIFIER_URL)
        self.assertEqual(verified['status'], 'okay')
        self.assertEqual(verified['email'], self.user.email)
        self.assertEqual(verified['audience'], AUDIENCE)
Example #2
0
    def test_persona_standard_sign_in(self):
        """
        Test standard sign in to UI tests app
        """
        uitests = UiTests(self.marionette)
        uitests.launch()
        uitests.tap_api_button()
        uitests.tap_mozId_button()

        persona = uitests.launch_standard_sign_in()
        persona.login(self.user.email, self.user.password)

        uitests.switch_to_mozId_frame()
        uitests.wait_for_login_event()
        uitests.tap_logout_button()
        uitests.wait_for_logout_event()

        assertion = uitests.get_assertion()
        assertionUtil = AssertionUtil()
        unpacked = assertionUtil.unpackAssertion(assertion)

        self.assertEqual(AUDIENCE, unpacked['payload']['aud'])
        self.assertEqual(self.user.email, unpacked['claim']['principal']['email'])

        verified = assertionUtil.verifyAssertion(assertion, AUDIENCE, VERIFIER_URL)
        self.assertEqual(verified['status'], 'okay')
        self.assertEqual(verified['email'], self.user.email)
        self.assertEqual(verified['audience'], AUDIENCE)
Example #3
0
    def test_persona_standard_sign_in(self):
        uitests = UiTests(self.marionette)
        uitests.launch()
        uitests.tap_api_button()
        moz_id = uitests.tap_moz_id_button()
        moz_id.switch_to_frame()

        persona = moz_id.tap_standard_sign_in()

        persona.login(self.user.email, self.user.password)

        moz_id.switch_to_frame()
        moz_id.wait_for_login_event()
        moz_id.tap_logout_button()
        moz_id.wait_for_logout_event()

        assertion = moz_id.get_assertion()
        assertionUtil = AssertionUtil()
        unpacked = assertionUtil.unpackAssertion(assertion)

        self.assertIn(AUDIENCE, unpacked["payload"]["aud"], "expected app://uitest.gaiamobile.org in the result")
        self.assertEqual(self.user.email, unpacked["claim"]["principal"]["email"])

        verified = assertionUtil.verifyAssertion(assertion, AUDIENCE, VERIFIER_URL)
        self.assertEqual(verified["status"], "okay")
        self.assertEqual(verified["email"], self.user.email)
        self.assertEqual(verified["audience"], AUDIENCE)