diff --git a/.docker/postgres-compose.yaml b/.docker/postgres-compose.yaml index a06ee6a..0b13ed6 100644 --- a/.docker/postgres-compose.yaml +++ b/.docker/postgres-compose.yaml @@ -1,5 +1,5 @@ services: - postgres: + postgres-dsst: image: postgres:15 container_name: postgres_db env_file: "../.env" @@ -13,5 +13,13 @@ services: timeout: 5s # Added missing timeout value retries: 5 + oddpub-dsst: + build: + context: ../services/oddpub + dockerfile: Dockerfile + container_name: oddpub_service + ports: + - "8071:8071" + volumes: postgres_data: diff --git a/tests/test_oddpub.py b/tests/test_oddpub.py index 630585a..d39c530 100644 --- a/tests/test_oddpub.py +++ b/tests/test_oddpub.py @@ -36,6 +36,17 @@ def tearDown(self): self.session.query(OddpubMetrics).delete() self.session.commit() + def test_oddpub_wrapper_without_mock_api(self): + self.wrapper.oddpub_host_api = "http://localhost:8071" + self.wrapper.process_pdfs("tests/pdf-test") + data = self.session.query(OddpubMetrics).all() + self.assertEqual(len(data), 2) + articles = [row.article for row in data] + self.assertIn("test1.txt", articles) + self.assertIn("test2.txt", articles) + + + @patch("dsst_etl.oddpub_wrapper.requests.post") def test_process_pdfs_success(self, mock_post): # Mock the response from the API