Skip to content

Commit 74dfe2e

Browse files
author
Gabriel Monroy
committed
check for initial web container in build.push
1 parent d045377 commit 74dfe2e

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

api/tests/build.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,28 @@ def test_build(self):
9797
self.assertEqual(self.client.delete(url).status_code, 405)
9898

9999
def test_build_push(self):
100+
"""
101+
Simlulate a git push creating a new Build object
102+
"""
103+
formation_id = 'autotest'
104+
url = '/api/formations/{formation_id}/layers'.format(**locals())
105+
body = {'id': 'runtime', 'flavor': 'autotest', 'runtime': True, 'proxy': True}
106+
response = self.client.post(url, json.dumps(body), content_type='application/json')
107+
self.assertEqual(response.status_code, 201)
108+
url = '/api/formations/{formation_id}/scale'.format(**locals())
109+
body = {'runtime': 2}
110+
response = self.client.post(url, json.dumps(body), content_type='application/json')
111+
self.assertEqual(response.status_code, 200)
100112
url = '/api/apps'
101-
body = {'formation': 'autotest'}
113+
body = {'formation': formation_id}
102114
response = self.client.post(url, json.dumps(body), content_type='application/json')
103115
self.assertEqual(response.status_code, 201)
104116
app_id = response.data['id']
105-
# simulate a git push calling Build.push()
106117
push = {'username': 'autotest', 'app': app_id}
107118
databag = Build.push(push)
108119
self.assertIn('release', databag)
120+
self.assertIn('version', databag['release'])
121+
self.assertIn('containers', databag)
122+
self.assertIn('web', databag['containers'])
123+
self.assertIn('1', databag['containers']['web'])
124+
self.assertEqual(databag['containers']['web']['1'], 'up')

0 commit comments

Comments
 (0)