Exemplo n.º 1
0
    def test_delete_application_superuser(self, auth_superuser_api_client,
                                          oauth_application, superuser):
        """
        Superusers are able to delete any oauth application
        """
        url = f'{self.ENDPOINT_BASE_URL}{oauth_application.pk}/'

        response = auth_superuser_api_client.delete(url)
        assert response.status_code == 204

        with pytest.raises(Application.DoesNotExist):
            Application.objects.get(pk=oauth_application.pk)
Exemplo n.º 2
0
    def test_delete_refreshtoken_superuser(self, auth_superuser_api_client,
                                           oauth_refresh_token, superuser):
        """
        Superusers are able to delete any access token
        """
        url = f'{self.ENDPOINT_BASE_URL}{oauth_refresh_token.pk}/'

        response = auth_superuser_api_client.delete(url)
        assert response.status_code == 204

        with pytest.raises(RefreshToken.DoesNotExist):
            RefreshToken.objects.get(pk=oauth_refresh_token.pk)
Exemplo n.º 3
0
    def test_delete_unexisting_application(self, auth_superuser_api_client,
                                           superuser):
        url = f'{self.ENDPOINT_BASE_URL}999/'

        response = auth_superuser_api_client.delete(url)
        assert response.status_code == 404