Example #1
0
    def test_check_for_unacknowledged_notices_no_unacknowledged_notices(self):
        """
        Verifies that we will return None if the user has no unack'd Notices in the plugin context data.
        """
        context = {
            "plugins": {
                "notices": {
                    "unacknowledged_notices": [],
                }
            }
        }

        results = check_for_unacknowledged_notices(context)
        assert results is None
Example #2
0
    def test_check_for_unacknowledged_notices_incorrect_data(self):
        """
        Verifies that we will return None (and no Exceptions are thrown) if the plugin context data doesn't match the
        expected form.
        """
        context = {
            "plugins": {
                "notices": {
                    "incorrect_key": [
                        '/notices/render/1/',
                        '/notices/render/2/',
                    ],
                }
            }
        }

        results = check_for_unacknowledged_notices(context)

        assert results is None
Example #3
0
    def test_check_for_unacknowledged_notices(self):
        """
        Happy path. Verifies that we return a URL in the proper form for a user that has an unack'd Notice.
        """
        context = {
            "plugins": {
                "notices": {
                    "unacknowledged_notices": [
                        '/notices/render/1/',
                        '/notices/render/2/',
                    ],
                }
            }
        }

        path = reverse("notices:notice-detail", kwargs={"pk": 1})
        expected_results = f"{settings.LMS_ROOT_URL}{path}?next={settings.LMS_ROOT_URL}/dashboard/"

        results = check_for_unacknowledged_notices(context)
        assert results == expected_results