Coder Social home page Coder Social logo

Comments (6)

gonvaled avatar gonvaled commented on August 17, 2024 2

@omab what if I really want to make sure that the integration of python social auth with my django project is working? I do not need to test that the social endpoints are working, but at least I would like to know that my site is doing right the request/reply cycle. How to go about this? Is there any example available?

from python-social-auth.

omab avatar omab commented on August 17, 2024

I don't see any social login there, just a UserSocialAuth instance being saved that's not used at all.

The problem with testing social authentication is the dependency with the third-parties that provider that auth for you, that's slow, prone to error and any user looking to run the tests need to register an application and define keys/secret for the desired backends. That's why tests on PSA are written using HTTPPretty to mock the server responses and focus on functionality testing instead.

from python-social-auth.

meconlin avatar meconlin commented on August 17, 2024

Sorry if I was not clear omab, I was not trying to test oauth in any meaningful way. I was simply trying to get an authenticated django.test.Client so that I can unit test REST endpoints. My mistake was thinking that it mattered how that Client got authenticated, for unit testing the tasteypie endpoints oauth really doesnt need to come into play at all.

this worked for me:

        self.user = User.objects.create(username='testuser', password='12345', is_active=True, is_staff=True, is_superuser=True) 
        self.user.set_password('hello') 
        self.user.save() 
        self.user = authenticate(username='testuser', password='hello') 
        login = self.c.login(username='testuser', password='hello') 
        self.assertTrue(login)

from python-social-auth.

ChillarAnand avatar ChillarAnand commented on August 17, 2024

Thank you @meconlin I had the same problem. Your script helped me a lot!

from python-social-auth.

rustoceans avatar rustoceans commented on August 17, 2024

Thanks man!

from python-social-auth.

idchlife avatar idchlife commented on August 17, 2024

@gonvaled +1

from python-social-auth.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.