Fixtures not being copied in classes derived from ChannelsLiveServerTestCase
ashtonrobinson opened this issue · comments
Ashton Robinson commented
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.