Skip to content

Commit

Permalink
Pass test passwords as env variables
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey Rusakov authored and lanseg committed Sep 26, 2024
1 parent 2e840d8 commit db56597
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ build:
clean:
docker compose rm -fsv

test: build
docker compose down
test:
docker compose --env-file ./test.env down
docker compose --env-file ./test.env --profile testing up --build updatedb test

acceptance: test
@echo Acceptance tests -- to be done
@echo Acceptance tests -- to be done
4 changes: 2 additions & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ services:
networks:
- default
environment:
- GEOSHOP_DEMO_LOGIN=admin:Test1234
- EXTRACT_DEMO_LOGIN=admin:motdepasse21
- GEOSHOP_DEMO_LOGIN=${GEOSHOP_DEMO_LOGIN}
- EXTRACT_DEMO_LOGIN=${EXTRACT_DEMO_LOGIN}
depends_on:
selenium:
condition: service_healthy
Expand Down
4 changes: 3 additions & 1 deletion test.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
TEST_MODE=True
FRONTEND_HOST=frontend
FRONTEND_PORT=80
FRONTEND_PORT=80
GEOSHOP_DEMO_LOGIN=admin:Test1234
EXTRACT_DEMO_LOGIN=admin:motdepasse21
10 changes: 3 additions & 7 deletions tests/extract_geoshop_smoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
SELENIUM_HOST = os.environ.get('SELENIUM_HOST', "http://selenium:4444") + "/wd/hub"
FRONTEND_HOST = os.environ.get('FRONTEND_HOST', "http://frontend")

REQUEST_PROCESS_WAIT = 20 # Seconds (Selenium default time unit)

# Geoshop and Extract testing credentials in the username:password format
EXTRACT_DEMO_LOGIN = tuple(os.environ.get("EXTRACT_DEMO_LOGIN").split(":"))
GEOSHOP_DEMO_LOGIN = tuple(os.environ.get("GEOSHOP_DEMO_LOGIN").split(":"))
Expand All @@ -34,8 +32,8 @@ def test_geoshopLoginLogout(self):
self.assertEqual(
self._driver.find_element(By.TAG_NAME, "title").get_attribute("innerText"),
"Geoshop API"
)
)

# Login
self._driver.find_element(By.LINK_TEXT, "Admin").click()
self._driver.find_element(By.ID, "id_username").send_keys(GEOSHOP_DEMO_LOGIN[0])
Expand All @@ -56,7 +54,6 @@ def test_geoshopLoginLogout(self):


def test_extractLoginLogout(self):
return
self._driver.get(f"{FRONTEND_HOST}/extract")
self.assertEqual(
self._driver.find_element(By.TAG_NAME, "title").get_attribute("innerText"),
Expand All @@ -77,8 +74,7 @@ def test_extractLoginLogout(self):
self._driver.find_element(By.ID, "logoutLink").click()
self.assertEqual(
self._driver.find_element(By.TAG_NAME, "title")
.get_attribute("innerText")
.strip(),
.get_attribute("innerText"),
"Extract",
)

Expand Down

0 comments on commit db56597

Please sign in to comment.