0

I would like to use Selenium for my test.

But when I try to connect to my tenant and then create a basic django User, I got the relation does not exist error.

I suppose that because I'm in a test, the migrations to my tenant are not made but I can't figure out how to do this.

my test.py

class VisitCreationTestCase(StaticLiveServerTestCase):

    fixtures = ['save.json']

    def check_connect(self, driver):

        driver.get(self.live_server_url.split("localhost")[0] + Domain.objects.first().domain + self.live_server_url.split("localhost")[1])
        title = driver.title
        username = driver.find_element(by=By.NAME, value="login")
        password = driver.find_element(by=By.NAME, value="password")
        submit_button = driver.find_element(by=By.CSS_SELECTOR, value="button[type='submit']")
        connection.set_tenant(Client.objects.first())

        User.objects.create(username="demo", password="testmdpusee")
        username.send_keys("demo")
        password.send_keys("testmdpusee")
        submit_button.click()
        driver.implicitly_wait(1)
        driver.find_element(by=By.XPATH, value="//p[contains(text(),'Aucun dossier ou fichier')]")        

    def setUp(self) -> None:
        service = ChromeService(executable_path=ChromeDriverManager().install())
        self.driver = webdriver.Chrome(service=service)
        self.check_connect(self.driver)

my save.json

[
    {
        "model": "client.client",
        "pk": 1,
        "fields": {
            "schema_name": "demo",
            "nom": "demo",
            "logo": "",
            "raison_social": "a",
            "SIRET": "b",
            "TVA": "c",
            "adresse": "d",
            "code_postal": "e",
            "ville": "f",
            "numero_de_telephone": "g",
            "adresse_email": "h",
            "credit": 999998,
            "iparco_token": "i",
            "sender_password": null,
            "sender_mail": null,
            "sender_host": "ssl0.ovh.net",
            "sender_port": "587",
            "created_on": "2022-09-06"
        }
    },
    {
        "model": "client.domain",
        "pk": 1,
        "fields": {
            "domain": "demo.localhost",
            "tenant": 1,
            "is_primary": true
        }
    }
]

If anyone has ever encountered this problem, I have no more idea to solve this...

Pollo9
  • 13
  • 3

0 Answers0