From 5b767ad06900b3946e0a9ad7c698520db9d5860d Mon Sep 17 00:00:00 2001 From: Jonathan LELIEVRE Date: Tue, 29 Oct 2024 13:35:31 +0100 Subject: [PATCH] Update generator tests --- tests/prestashop_docker/test_generator.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/tests/prestashop_docker/test_generator.py b/tests/prestashop_docker/test_generator.py index 215fd59f..dd63c835 100644 --- a/tests/prestashop_docker/test_generator.py +++ b/tests/prestashop_docker/test_generator.py @@ -28,7 +28,8 @@ def setUp(self): self.generator = Generator( '/tmp/images', open('Dockerfile.model').read(), - open('Dockerfile-nightly.model').read() + open('Dockerfile-nightly.model').read(), + open('Dockerfile-branch.model').read() ) def test_create_directory(self): @@ -92,6 +93,26 @@ def test_generate_nightly_image(self): self.assertIn('PS_VERSION: nightly', content) self.assertIn('CONTAINER_VERSION: 7.2-alpine', content) + def test_generate_branch_image(self): + dockerfile = '/tmp/images/9.0.x/8.1-alpine/Dockerfile' + self.assertFalse(path.exists(dockerfile)) + self.generator.generate_image( + '9.0.x', + '8.1-alpine' + ) + self.assertTrue(path.exists(dockerfile)) + + with open(dockerfile) as f: + content = f.read() + self.assertNotIn( + 'PS_URL', + content + ) + self.assertNotIn('PS_VERSION', content) + self.assertIn('CONTAINER_VERSION: 8.1-alpine', content) + self.assertIn('RUN apt -y install git', content) + self.assertIn('RUN git clone -b 9.0.x https://github.com/PrestaShop/PrestaShop.git /tmp/data-ps', content) + def test_generate_all(self): files = ( '/tmp/images/7.0/7.3-apache/Dockerfile',