Пример #1
0
    def setUp(self):
        """
        Instantiate the page objects.
        """
        super(OAuth2FlowTests, self).setUp()

        self.app_login_page = DashboardHomePage(self.browser)
    def setUp(self):
        """ Instantiate the page objects. """
        super(CouponCheckoutTests, self).setUp()

        self.app_login_page = DashboardHomePage(self.browser)
        self.basket_page = BasketPage(self.browser)
        self.coupons_create_edit_page = CouponsCreatePage(self.browser)
        self.coupons_list_page = CouponsListPage(self.browser)
        self.coupons_details_page = CouponsDetailsPage(self.browser)
        self.redeem_voucher_page = RedeemVoucherPage(self.browser)

        self.course_id = VERIFIED_COURSE_ID
        self.username, self.password, self.email = self.get_lms_user()
        self.login_with_lms()
Пример #3
0
    def setUp(self):
        """
        Instantiate the page objects.
        """
        super(OAuth2FlowTests, self).setUp()

        self.app_login_page = DashboardHomePage(self.browser)
Пример #4
0
class OAuth2FlowTests(LogistrationMixin, WebAppTest):
    def setUp(self):
        """
        Instantiate the page objects.
        """
        super(OAuth2FlowTests, self).setUp()

        self.app_login_page = DashboardHomePage(self.browser)

    def test_login(self):
        """
        Note: If you are testing locally with a VM and seeing signature expiration errors, ensure the clocks of the VM
        and host are synced within at least one minute (the default signature expiration time) of each other.
        """
        self.login_with_lms()

        # Visit login URL and get redirected
        self.app_login_page.visit()
Пример #5
0
class OAuth2FlowTests(LoginMixin, WebAppTest):
    def setUp(self):
        """
        Instantiate the page objects.
        """
        super(OAuth2FlowTests, self).setUp()

        self.app_login_page = DashboardHomePage(self.browser)

    def test_login(self):
        """
        Note: If you are testing locally with a VM and seeing signature expiration errors, ensure the clocks of the VM
        and host are synced within at least one minute (the default signature expiration time) of each other.
        """
        self.login_with_lms()

        # Visit login URL and get redirected
        self.app_login_page.visit()
Пример #6
0
class SingleSignOnTests(LogistrationMixin, LogoutMixin, LMSLogoutMixin,
                        WebAppTest):
    def setUp(self):
        """ Instantiate the page objects. """
        super(SingleSignOnTests, self).setUp()
        self.otto_dashboard_page = DashboardHomePage(self.browser)

    def test_login_and_logout(self):
        """
        Note: If you are testing locally with a VM and seeing signature expiration errors, ensure the clocks of the VM
        and host are synced within at least one minute (the default signature expiration time) of each other.
        """
        self.login_with_lms()

        # Visit the Otto dashboard to trigger an OpenID Connect login
        self.otto_dashboard_page.visit()

        # Logging out of Otto should redirect the user to the LMS logout page, which redirects
        # to the marketing site (if available) or the LMS homepage.
        self.logout_via_otto()
        self.assertIn(self.browser.current_url.strip('/'),
                      [MARKETING_URL_ROOT, LMS_URL_ROOT])

    def test_lms_logout(self):
        """ Verify that logging out of the LMS also logs the user out of Otto. """
        self.login_with_lms()
        self.otto_dashboard_page.visit()
        self.logout_via_lms()

        # Now that the user has been logged out, navigating to the dashboard should result in the user being
        # redirected to the LMS login page. This indicates the user has been logged out of both LMS and Otto.
        # Since the user is logged out, calling otto_dashboard_page.visit() will timeout. This is due to the fact that
        # visit() expects the browser to be on the actual dashboard page. We are accessing the page directly
        # to avoid this issue.
        self.browser.get(self.otto_dashboard_page.url)
        self.assertTrue(self.lms_login_page.is_browser_on_page())
Пример #7
0
 def setUp(self):
     """ Instantiate the page objects. """
     super(SingleSignOnTests, self).setUp()
     self.otto_dashboard_page = DashboardHomePage(self.browser)
class CouponCheckoutTests(CouponMixin, UnenrollmentMixin, EcommerceApiMixin, EnrollmentApiMixin, LogistrationMixin,
                          PaymentMixin, WebAppTest):
    def setUp(self):
        """ Instantiate the page objects. """
        super(CouponCheckoutTests, self).setUp()

        self.app_login_page = DashboardHomePage(self.browser)
        self.basket_page = BasketPage(self.browser)
        self.coupons_create_edit_page = CouponsCreatePage(self.browser)
        self.coupons_list_page = CouponsListPage(self.browser)
        self.coupons_details_page = CouponsDetailsPage(self.browser)
        self.redeem_voucher_page = RedeemVoucherPage(self.browser)

        self.course_id = VERIFIED_COURSE_ID
        self.username, self.password, self.email = self.get_lms_user()
        self.login_with_lms()

    def start_redeem_flow(self, is_discount=False):
        """ Start redemption flow by creating a coupon via the UI and then accepting the offer """
        self.prepare_coupon(is_discount)

        # Get the redeem URL for the coupon's detail page and go to it.
        redeem_url = self.coupons_details_page.get_redeem_url()
        self.browser.get(redeem_url)
        self.assertTrue(self.redeem_voucher_page.is_browser_on_page())

        if is_discount:
            self.redeem_voucher_page.proceed_to_checkout()
        else:
            self.redeem_voucher_page.proceed_to_enrollment()

    def prepare_coupon(self, is_discount=False):
        """ Create a test coupon and open its details page. """
        self.app_login_page.visit()
        self.assertTrue(self.app_login_page.is_browser_on_page())

        self.coupons_list_page.visit().create_new_coupon()
        self.coupons_create_edit_page.fill_create_coupon_form(is_discount)
        self.assertTrue(self.coupons_details_page.is_browser_on_page())

    def test_enrollment_code_redemption(self):
        """ Test redeeming an enrollment code enrolls the learner. """
        self.start_redeem_flow()
        self.assert_order_created_and_completed()
        self.assert_user_enrolled(self.username, self.course_id, mode='verified')

    def test_discount_checkout_with_paypal(self):
        """ Test redemption of discount code and purchase of course via PayPal """
        self.start_redeem_flow(is_discount=True)
        self.assertTrue(self.basket_page.is_browser_on_page())
        self.checkout_with_paypal()

        self.assert_receipt_page_loads()
        self.assert_order_created_and_completed()
        self.assert_user_enrolled(self.username, self.course_id, 'verified')

    @skipUnless(ENABLE_CYBERSOURCE_TESTS, 'CyberSource tests are not enabled.')
    @ddt.data(CYBERSOURCE_DATA1, CYBERSOURCE_DATA2)
    def test_discount_checkout_with_cybersource(self, address):
        """ Test redemption of discount code and purchase of course via Cybersource """
        self.start_redeem_flow(is_discount=True)
        self.assertTrue(self.basket_page.is_browser_on_page())
        self.checkout_with_cybersource(address)

        self.assert_receipt_page_loads()
        self.assert_order_created_and_completed()
        self.assert_user_enrolled(self.username, self.course_id, 'verified')