Skip to content

Commit c942eec

Browse files
author
Gabriel Monroy
committed
fix hook tests and import into test runner
1 parent 2c923fd commit c942eec

2 files changed

Lines changed: 11 additions & 14 deletions

File tree

api/tests/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ def run_tests(self, test_labels, extra_tests=None, **kwargs):
4848
from .test_container import * # noqa
4949
from .test_flavor import * # noqa
5050
from .test_formation import * # noqa
51+
from .test_hooks import * # noqa
5152
from .test_key import * # noqa
5253
from .test_layer import * # noqa
5354
from .test_node import * # noqa

api/tests/test_hooks.py

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -143,23 +143,19 @@ def test_build_hook(self):
143143
# post the build with the builder auth key
144144
response = self.client.post(url, json.dumps(body), content_type='application/json',
145145
HTTP_X_DEIS_BUILDER_AUTH=settings.BUILDER_KEY)
146-
self.assertEqual(response.status_code, 201)
147-
build = response.data
148-
self.assertIn('sha', response.data)
149-
self.assertIn('procfile', response.data)
150-
procfile = json.loads(response.data['procfile'])
151-
self.assertIn('web', procfile)
152-
self.assertEqual(procfile['web'], 'node server.js')
153-
# calculate the databag
154-
self.assertTrue(
155-
self.client.login(username='autotest', password='password'))
156-
url = '/api/apps/{app_id}/calculate'.format(**locals())
157-
response = self.client.post(url)
158146
self.assertEqual(response.status_code, 200)
159147
databag = response.data
160-
self.assertIn('release', databag)
161-
self.assertIn('version', databag['release'])
148+
# assert release structure
149+
release = databag['release']
150+
self.assertIn('config', release)
151+
self.assertIn('build', release)
152+
self.assertIn('version', release)
153+
self.assertIn('domains', databag)
162154
self.assertIn('containers', databag)
163155
self.assertIn('web', databag['containers'])
164156
self.assertIn('1', databag['containers']['web'])
165157
self.assertEqual(databag['containers']['web']['1'], 'up')
158+
# assert procfile structure
159+
self.assertIn('procfile', release['build'])
160+
self.assertIn('web', release['build']['procfile'])
161+
self.assertEqual(release['build']['procfile']['web'], 'node server.js')

0 commit comments

Comments
 (0)