Configuring a StaticLiveTestCase Server In A Docker Container

93 views
Skip to first unread message

Ross

unread,
Dec 23, 2019, 4:31:24 PM12/23/19
to Django users

Hi,


I am able to spawn a separate live development server process for a selenium test which inherits from LiveServerTestCase with the following -


#globals
HTTP = "http://"
# ip address of host machine on the default docker network
LOCALHOST = settings.HOST_LOCALHOST
# port number on host the docker selenium remote server is exposed on
SEL_PORT = 4444


class SignUpViewFunctionalTests(LiveServerTestCase):

    port = 9000
    host = '0.0.0.0'
    live_server_url = HTTP + LOCALHOST + ":" + "9000"

    def setUp(self):
        settings.DEBUG = True
        self.driver = webdriver.Remote(
            HTTP + LOCALHOST + ":" + str(SEL_PORT) + "/wd/hub",
            DesiredCapabilities.CHROME
        )


This causes two parallel processes to run in the web docker container; the default, waiting for requests on 0.0.0.0:8000 and the process spawned when running the test which is listening on 0.0.0.0:9000. Via the selenium remote server which I connect to via RealVNC I see the Chrome browser start up at '172.0.17.1:9000/accounts/signup' and during the test everything works fine - the signed up user is created which confirms that the test running process is using a separate test database. The only thing I did notice was my static files weren't pulling through - I was using white-noise locally, which works fine on the default web process waiting for requests on 0.0.0.0:8000.

So I changed the test so that it inherits from 'StaticLiveServerTestCase' and it causes an error - the user is already signed up, confirming that the test DID NOT use a separate database.


How do I configure this so that it works with StaticLiveServerTestCase also? The documentation doesn't seem to say much.

Dvs Khamele

unread,
Jan 23, 2020, 12:56:05 AM1/23/20
to django...@googlegroups.com
Hi Roshan,
We are Pythonmate, We work extensively on Python, Django, Flask and Js based applications, erps, etc.
If any requirements you have please let us know. We may provide good commissions to your company.
Because we are looking for a longterm network.
Thanks & Regards
Divyesh Khamele,
Founder, Pythonmate

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/63af07ee-e794-4411-90dd-bda4523e4ede%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages