How to use the function in richie

To help you get started, we’ve selected a few richie examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github openfun / richie / tests / apps / courses / View on Github external
self.add_permission(user, "add_page")
        if not can_add_page and random.choice([True, False]):
            self.add_permission(user, "change_page")

        # Trigger the creation of a snapshot for the course
        url = "/en/admin/courses/course/{:d}/snapshot/".format(
        with mock.patch("time.time", mock.MagicMock(return_value=1541946888)):
            response =, follow=True)

        self.assertEqual(response.status_code, 403)
            b"You don't have sufficient permissions to snapshot this page.",
        # No additional courses should have been created
        self.assertEqual(Course.objects.count(), 2)
github openfun / richie / tests / apps / courses / View on Github external
def test_models_person_get_courses_several_languages(self):
        The courses should not be duplicated if they exist in several languages.
        person = PersonFactory(should_publish=True)
            page_title={"en": "my title", "fr": "mon titre"},
        self.assertEqual(Course.objects.count(), 2)
        self.assertEqual(person.get_courses().count(), 1)