Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixtures not being copied in classes derived from ChannelsLiveServerTestCase #2030

Open
ashtonrobinson opened this issue Jul 13, 2023 · 0 comments

Comments

@ashtonrobinson
Copy link

Hello,
I am using macOS Monterey version 12.6, and I am using a virtual environment with python 3.11. I am using ChannelsLiveServerTestCase
I am unable to properly load my fixtures because when I use selenium to login, I receive a user denied user error.
Here is my test class.

class DiscoveryLiveTest(ChannelsLiveServerTestCase):
    fixtures = ['people.json']
    
    @classmethod
    def setUpClass(cls) ->  None:
        service = Service(settings.SELENIUM_DRIVER + DEFAULT_EXECUTABLE_PATH)
        cls.driver = webdriver.Chrome(service=service)

        super().setUpClass()

    @classmethod
    def tearDownClass(cls) -> None:
        cls.driver.quit()
        super().tearDownClass()
    

    def login(self, username:str, password:str):
        self.driver.get(self.live_server_url + '/login/')

        body = self.driver.find_element(By.TAG_NAME, 'tbody')
        user_input_field = body.find_element(By.NAME, 'username')
        password_input_field = body.find_element(By.NAME, 'password')

        user_input_field.send_keys(username)
        password_input_field.send_keys(password)

        login_button = body.find_element(By.CLASS_NAME, 'cnButton')
        login_button.click()

        time.sleep(3)

    def test_click(self):
        self.login('admin_orgOne',  'tempPass')

I further inspected this bug and found that the when the Daphne server is started, a new instance of the Django ModelBackend is created.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant