Esempio n. 1
0
    def setUp(self):
        super(TestApiDataRetrieval, self).setUp()
        ClientFactory(name=CredentialsApiConfig.OAUTH2_CLIENT_NAME, client_type=CONFIDENTIAL)
        ClientFactory(name=ProgramsApiConfig.OAUTH2_CLIENT_NAME, client_type=CONFIDENTIAL)
        self.user = UserFactory()

        cache.clear()
Esempio n. 2
0
 def setUp(self):
     self.client_name = "edx-dummy-client"
     ClientFactory(name=self.client_name)
     super(GetIdTokenTest, self).setUp()
     self.user = UserFactory.create(username="******",
                                    email="*****@*****.**",
                                    password="******")
     self.client.login(username=self.user.username, password="******")
Esempio n. 3
0
 def test_oauth(self):
     """ Verify the endpoint supports authentication via OAuth 2.0. """
     access_token = AccessTokenFactory(user=self.user,
                                       client=ClientFactory()).token
     headers = {'HTTP_AUTHORIZATION': 'Bearer ' + access_token}
     self.client.logout()
     response = self.client.get(self.path, **headers)
     self.assertEqual(response.status_code, 200)
Esempio n. 4
0
    def setUp(self):
        super(TestIdTokenGeneration, self).setUp()

        self.oauth2_client = ClientFactory(name=self.client_name,
                                           client_type=CONFIDENTIAL)

        self.user = UserFactory.build()
        self.user.save()
Esempio n. 5
0
 def setUp(self):
     ClientFactory(name="edx-notes")
     self.course = CourseFactory.create(edxnotes=True)
     self.user = UserFactory.create(username="******",
                                    email="*****@*****.**",
                                    password="******")
     self.client.login(username=self.user.username, password="******")
     self.problem = TestProblem(self.course)
    def setUp(self):
        super(TestIdTokenGeneration, self).setUp()

        self.oauth2_client = ClientFactory(name=self.client_name,
                                           client_type=CONFIDENTIAL)
        self.user = UserFactory()

        # Create a profile for the user
        self.user_profile = UserProfileFactory(user=self.user)
Esempio n. 7
0
    def setUp(self):
        super(TestProgramListing, self).setUp()

        ClientFactory(name=ProgramsApiConfig.OAUTH2_CLIENT_NAME, client_type=CONFIDENTIAL)

        self.staff = UserFactory(is_staff=True)
        self.client.login(username=self.staff.username, password='******')

        self.studio_home = reverse('home')
Esempio n. 8
0
    def test_oauth(self):
        """Verify that the endpoint supports OAuth 2.0."""
        access_token = AccessTokenFactory(user=self.user,
                                          client=ClientFactory()).token  # pylint: disable=no-member
        self.headers['HTTP_AUTHORIZATION'] = 'Bearer ' + access_token

        self.client.logout()

        self._verify_response(200)
Esempio n. 9
0
 def setUp(self):
     """
         Add a student
     """
     super(TestProgramListing, self).setUp()
     ClientFactory(name=ProgramsApiConfig.OAUTH2_CLIENT_NAME,
                   client_type=CONFIDENTIAL)
     self.student = UserFactory()
     self.create_programs_config(xseries_ad_enabled=True)
Esempio n. 10
0
    def setUp(self):
        """
        Setup a dummy course content.
        """
        super(EdxNotesHelpersTest, self).setUp()

        # There are many tests that are comparing locators as returned from helper methods. When using
        # the split modulestore, some of those locators have version and branch information, but the
        # comparison values do not. This needs further investigation in order to enable these tests
        # with the split modulestore.
        with self.store.default_store(ModuleStoreEnum.Type.mongo):
            ClientFactory(name="edx-notes")
            self.course = CourseFactory.create()
            self.chapter = ItemFactory.create(
                category="chapter", parent_location=self.course.location)
            self.chapter_2 = ItemFactory.create(
                category="chapter", parent_location=self.course.location)
            self.sequential = ItemFactory.create(
                category="sequential", parent_location=self.chapter.location)
            self.vertical = ItemFactory.create(
                category="vertical", parent_location=self.sequential.location)
            self.html_module_1 = ItemFactory.create(
                category="html", parent_location=self.vertical.location)
            self.html_module_2 = ItemFactory.create(
                category="html", parent_location=self.vertical.location)
            self.vertical_with_container = ItemFactory.create(
                category='vertical', parent_location=self.sequential.location)
            self.child_container = ItemFactory.create(
                category='split_test',
                parent_location=self.vertical_with_container.location)
            self.child_vertical = ItemFactory.create(
                category='vertical',
                parent_location=self.child_container.location)
            self.child_html_module = ItemFactory.create(
                category="html", parent_location=self.child_vertical.location)

            # Read again so that children lists are accurate
            self.course = self.store.get_item(self.course.location)
            self.chapter = self.store.get_item(self.chapter.location)
            self.chapter_2 = self.store.get_item(self.chapter_2.location)
            self.sequential = self.store.get_item(self.sequential.location)
            self.vertical = self.store.get_item(self.vertical.location)

            self.vertical_with_container = self.store.get_item(
                self.vertical_with_container.location)
            self.child_container = self.store.get_item(
                self.child_container.location)
            self.child_vertical = self.store.get_item(
                self.child_vertical.location)
            self.child_html_module = self.store.get_item(
                self.child_html_module.location)

            self.user = UserFactory.create(username="******",
                                           email="*****@*****.**",
                                           password="******")
            self.client.login(username=self.user.username, password="******")
Esempio n. 11
0
 def setUp(self):
     ClientFactory(name="edx-notes")
     super(EdxNotesViewsTest, self).setUp()
     self.course = CourseFactory.create(edxnotes=True)
     self.user = UserFactory.create(username="******", email="*****@*****.**", password="******")
     self.client.login(username=self.user.username, password="******")
     self.notes_page_url = reverse("edxnotes", args=[unicode(self.course.id)])
     self.search_url = reverse("search_notes", args=[unicode(self.course.id)])
     self.get_token_url = reverse("get_token", args=[unicode(self.course.id)])
     self.visibility_url = reverse("edxnotes_visibility", args=[unicode(self.course.id)])
Esempio n. 12
0
    def setUp(self):
        super(EdxNotesDecoratorTest, self).setUp()

        ClientFactory(name="edx-notes")
        # Using old mongo because of locator comparison issues (see longer
        # note below in EdxNotesHelpersTest setUp.
        self.course = CourseFactory.create(edxnotes=True, default_store=ModuleStoreEnum.Type.mongo)
        self.user = UserFactory.create(username="******", email="*****@*****.**", password="******")
        self.client.login(username=self.user.username, password="******")
        self.problem = TestProblem(self.course)
Esempio n. 13
0
    def setUp(self):
        self.client_secret = 'some_secret'
        self.auth_client = ClientFactory(client_secret=self.client_secret)

        self.password = '******'
        self.user_factory = UserFactory

        self.user = None
        self.access_token = None
        self.set_user(self.make_user())
Esempio n. 14
0
    def setUp(self):
        """
        Setup a dummy course content.
        """
        super(EdxNotesHelpersTest, self).setUp()
        ClientFactory(name="edx-notes")
        self.course = CourseFactory.create()
        self.chapter = ItemFactory.create(category="chapter",
                                          parent_location=self.course.location)
        self.chapter_2 = ItemFactory.create(
            category="chapter", parent_location=self.course.location)
        self.sequential = ItemFactory.create(
            category="sequential", parent_location=self.chapter.location)
        self.vertical = ItemFactory.create(
            category="vertical", parent_location=self.sequential.location)
        self.html_module_1 = ItemFactory.create(
            category="html", parent_location=self.vertical.location)
        self.html_module_2 = ItemFactory.create(
            category="html", parent_location=self.vertical.location)
        self.vertical_with_container = ItemFactory.create(
            category='vertical', parent_location=self.sequential.location)
        self.child_container = ItemFactory.create(
            category='split_test',
            parent_location=self.vertical_with_container.location)
        self.child_vertical = ItemFactory.create(
            category='vertical', parent_location=self.child_container.location)
        self.child_html_module = ItemFactory.create(
            category="html", parent_location=self.child_vertical.location)

        # Read again so that children lists are accurate
        self.course = self.store.get_item(self.course.location)
        self.chapter = self.store.get_item(self.chapter.location)
        self.chapter_2 = self.store.get_item(self.chapter_2.location)
        self.sequential = self.store.get_item(self.sequential.location)
        self.vertical = self.store.get_item(self.vertical.location)

        self.vertical_with_container = self.store.get_item(
            self.vertical_with_container.location)
        self.child_container = self.store.get_item(
            self.child_container.location)
        self.child_vertical = self.store.get_item(self.child_vertical.location)
        self.child_html_module = self.store.get_item(
            self.child_html_module.location)

        self.user = UserFactory.create(username="******",
                                       email="*****@*****.**",
                                       password="******")
        self.client.login(username=self.user.username, password="******")