Skip to content

Commit

Permalink
Update generator tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jolelievre committed Oct 29, 2024
1 parent a589264 commit 5b767ad
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion tests/prestashop_docker/test_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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',
Expand Down

0 comments on commit 5b767ad

Please sign in to comment.