コード例 #1
0
    def setUp(self):
        super(EnterpriseLogoutTests, self).setUp()
        self.user = UserFactory()

        self.enterprise_customer = FAKE_ENTERPRISE_CUSTOMER
        self.enterprise_learner = factories.EnterpriseCustomerUserFactory(user_id=self.user.id)

        self.client.login(username=self.user.username, password='******')
        patcher = mock.patch('openedx.features.enterprise_support.api.enterprise_customer_from_api')
        self.mock_enterprise_customer_from_api = patcher.start()
        self.mock_enterprise_customer_from_api.return_value = self.enterprise_customer
        self.addCleanup(patcher.stop)
コード例 #2
0
    def setUp(self):
        """Initiate commonly needed objects."""
        super(EnterpriseMiddlewareTest, self).setUp()

        # Customer & Learner details.
        self.user = UserFactory.create(username='******',
                                       password='******')
        self.enterprise_customer = FAKE_ENTERPRISE_CUSTOMER
        self.enterprise_learner = factories.EnterpriseCustomerUserFactory(
            user_id=self.user.id)

        # Request details.
        self.client.login(username='******', password='******')
        self.dashboard = reverse('dashboard')

        # Mocks.
        patcher = mock.patch(
            'openedx.features.enterprise_support.api.enterprise_customer_from_api'
        )
        self.mock_enterprise_customer_from_api = patcher.start()
        self.mock_enterprise_customer_from_api.return_value = self.enterprise_customer
        self.addCleanup(patcher.stop)