예제 #1
0
    def test_generate_login_url_cache(self):
        """ Test caching for _generate_login_url() """

        def key_mock(url, request):
            return self.test_xml

        # Populate cache
        with HTTMock(key_mock):
            intershift_plugin._generate_login_url(
                'site1', self.user.username
            )

        def fail_mock(url, request):
            self.fail('Request should not be fired when using cache.')

        with HTTMock(fail_mock):
            login_url = intershift_plugin._generate_login_url(
                'site1', self.user.username
            )

        self.assertEquals(
            login_url,
            self.test_login_url
        )
예제 #2
0
    def test_generate_login_url(self):
        """ Test _generate_login_url() """

        def key_mock(url, request):
            return self.test_xml

        with HTTMock(key_mock):
            login_url = intershift_plugin._generate_login_url(
                'site1', self.user.username
            )

        self.assertEquals(
            login_url,
            self.test_login_url
        )