0

Mismatch

I am currently testing my website on a local webserver.

The localhost port localhost:[port] keeps changing everytime I run the python3 manage.py unittest.

As a result of the localhost:port changing on every test, it cannot match the url [localhost:'port'] with the redirect url that I have entered in the Oauth credentials.

How am I able to run my unittests and have the browser use a certain port every time?

I'm currently following the taskbuster django tutorial http://www.marinamele.com/user-authentication-with-google-using-django-allauth taskbuster

If you scroll down on that page to the following section "indicating that the redirect URI at http://localhost:8081 is not valid. This is because we registered a different url, http://127.0.0.1:8000, and not the one that is used by tests." Then my problem will become apparent.

To summarise

1.I've registed the callback url to be http:127.0.0.1:8081

  1. Everytime I run the unit test, the web server runs on the follwoing 'http:127.0.0.1:53000' or a variant of that number.

    1. How do I get the test to run on a designated port.
1

1 Answer 1

0

SOLUTION:

After some research and asking some Django Users - The solution was to add below the test class, port = 8010.

class TestGoogleLogin(StaticLiveServerTestCase):

    fixtures = ['allauth_fixture']
    port = 8010

    def setUp(self):
        "CODE"

Not the answer you're looking for? Browse other questions tagged or ask your own question.