From c0c1276a09848a18edb40ca7599e736ac60586ae Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Sat, 30 Nov 2024 09:57:07 +0100 Subject: [PATCH] fix warnings --- .gitignore | 1 + .../management/commands/import_harmful_states.py | 2 +- src/character/management/commands/import_paths.py | 2 +- src/character/management/commands/import_profiles.py | 2 +- src/character/management/commands/import_races.py | 2 +- src/character/tests/test_pet.py | 8 +++++--- 6 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 31d6e36..64c4ba3 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,4 @@ dashboard_templates/backup_*.zip character.json .direnv/ .venv/ +node_modules diff --git a/src/character/management/commands/import_harmful_states.py b/src/character/management/commands/import_harmful_states.py index 02dc919..e87701b 100644 --- a/src/character/management/commands/import_harmful_states.py +++ b/src/character/management/commands/import_harmful_states.py @@ -28,7 +28,7 @@ class Command(BaseCommand): icon_url = state_row.find_element( By.CSS_SELECTOR, ".views-field-field-svg-icon img", - ).get_attribute("src") + ).get_dom_attribute("src") state, _ = HarmfulState.objects.update_or_create( name=name, defaults={"description": description, "url": url, "icon_url": icon_url}, diff --git a/src/character/management/commands/import_paths.py b/src/character/management/commands/import_paths.py index 08b8523..805df13 100644 --- a/src/character/management/commands/import_paths.py +++ b/src/character/management/commands/import_paths.py @@ -19,7 +19,7 @@ class Command(BaseCommand): By.CSS_SELECTOR, ".card-body .card-title a", ) - urls = [anchor.get_attribute("href") for anchor in anchors] + urls = [anchor.get_dom_attribute("href") for anchor in anchors] for url in urls: try: self.import_path(url) diff --git a/src/character/management/commands/import_profiles.py b/src/character/management/commands/import_profiles.py index 6616d9d..d5c26d0 100644 --- a/src/character/management/commands/import_profiles.py +++ b/src/character/management/commands/import_profiles.py @@ -12,7 +12,7 @@ class Command(BaseCommand): self.setup_selenium() self.selenium.get(url) anchors = self.selenium.find_elements(By.CSS_SELECTOR, ".card-img-top a") - urls = [anchor.get_attribute("href") for anchor in anchors] + urls = [anchor.get_dom_attribute("href") for anchor in anchors] for url in urls: try: self.import_profile(url) diff --git a/src/character/management/commands/import_races.py b/src/character/management/commands/import_races.py index 95adfab..2f3f1eb 100644 --- a/src/character/management/commands/import_races.py +++ b/src/character/management/commands/import_races.py @@ -11,7 +11,7 @@ class Command(BaseCommand): self.setup_selenium() self.selenium.get(url) anchors = self.selenium.find_elements(By.CSS_SELECTOR, "h2 a") - urls = [anchor.get_attribute("href") for anchor in anchors] + urls = [anchor.get_dom_attribute("href") for anchor in anchors] for url in urls: try: self.import_race(url) diff --git a/src/character/tests/test_pet.py b/src/character/tests/test_pet.py index 5a0527c..19ad943 100644 --- a/src/character/tests/test_pet.py +++ b/src/character/tests/test_pet.py @@ -79,10 +79,12 @@ def test_pet_happy_path(selenium: WebDriver, live_server: LiveServer): # I have the same form as previously, pre-filled with the current values of my pet. selenium.find_element(By.CSS_SELECTOR, f".pet[data-id='{pet.pk}'] .edit").click() pet_name = selenium.find_element(By.ID, "id_name") - assert pet_name.get_attribute("value") == "My pet" - assert selenium.find_element(By.ID, "id_health_max").get_attribute("value") == "10" + assert pet_name.get_dom_attribute("value") == "My pet" assert ( - selenium.find_element(By.ID, "id_health_remaining").get_attribute("value") + selenium.find_element(By.ID, "id_health_max").get_dom_attribute("value") == "10" + ) + assert ( + selenium.find_element(By.ID, "id_health_remaining").get_dom_attribute("value") == "9" ) pet_name.clear()