Exemple #1
0
    def test_get_context_data_when_social_app_exists_on_wrong_site(self):
        """Test getting context data when social app exists on wrong site."""
        view = ProviderOverview()
        view.request = APIRequestFactory().get(self.url)

        SocialApp.objects.create(
            provider="google", name="Google", client_id="xxxxxxxxxxxxxxxxxx", secret="xxxxxxxxxxxxxxxxxx", key=""
        )

        context = view.get_context_data("google")

        self.assertIsNotNone(context.get("provider"))
        self.assertIsNone(context.get("social_app"))
Exemple #2
0
    def test_get_context_data_when_social_app_doesnt_exist(self):
        """Test getting context data when social app doesn't exist."""
        view = ProviderOverview()
        view.request = APIRequestFactory().get(self.url)

        social_app = SocialApp.objects.create(
            provider="facebook", name="Facebook", client_id="xxxxxxxxxxxxxxxxxx", secret="xxxxxxxxxxxxxxxxxx", key=""
        )
        social_app.sites.add(get_current_site(view.request))

        context = view.get_context_data("google")

        self.assertIsNotNone(context.get("provider"))
        self.assertIsNone(context.get("social_app"))
Exemple #3
0
    def test_get_context_data_when_social_app_exists_on_wrong_site(self):
        """Test getting context data when social app exists on wrong site."""
        view = ProviderOverview()
        view.request = APIRequestFactory().get(self.url)

        SocialApp.objects.create(provider='google',
                                 name='Google',
                                 client_id='xxxxxxxxxxxxxxxxxx',
                                 secret='xxxxxxxxxxxxxxxxxx',
                                 key='')

        context = view.get_context_data('google')

        self.assertIsNotNone(context.get('provider'))
        self.assertIsNone(context.get('social_app'))
Exemple #4
0
    def test_get_context_data_when_social_app_doesnt_exist(self):
        """Test getting context data when social app doesn't exist."""
        view = ProviderOverview()
        view.request = APIRequestFactory().get(self.url)

        social_app = SocialApp.objects.create(provider='facebook',
                                              name='Facebook',
                                              client_id='xxxxxxxxxxxxxxxxxx',
                                              secret='xxxxxxxxxxxxxxxxxx',
                                              key='')
        social_app.sites.add(get_current_site(view.request))

        context = view.get_context_data('google')

        self.assertIsNotNone(context.get('provider'))
        self.assertIsNone(context.get('social_app'))
Exemple #5
0
    def test_get_context_data_when_social_app_exists_on_wrong_site(self):
        """Test getting context data when social app exists on wrong site."""
        view = ProviderOverview()
        view.request = APIRequestFactory().get(self.url)

        SocialApp.objects.create(
            provider='google',
            name='Google',
            client_id='xxxxxxxxxxxxxxxxxx',
            secret='xxxxxxxxxxxxxxxxxx',
            key=''
        )

        context = view.get_context_data('google')

        self.assertIsNotNone(context.get('provider'))
        self.assertIsNone(context.get('social_app'))
Exemple #6
0
    def test_get_context_data_when_social_app_doesnt_exist(self):
        """Test getting context data when social app doesn't exist."""
        view = ProviderOverview()
        view.request = APIRequestFactory().get(self.url)

        social_app = SocialApp.objects.create(
            provider='facebook',
            name='Facebook',
            client_id='xxxxxxxxxxxxxxxxxx',
            secret='xxxxxxxxxxxxxxxxxx',
            key=''
        )
        social_app.sites.add(get_current_site(view.request))

        context = view.get_context_data('google')

        self.assertIsNotNone(context.get('provider'))
        self.assertIsNone(context.get('social_app'))