Skip to content

Commit

Permalink
Added lift unit test (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
liranbg authored Feb 23, 2020
1 parent 99c7f87 commit a35eaa3
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions tests/unit/test_manof.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,26 @@ def setUp(self):
def name(self):
return self.__class__.__name__

@defer.inlineCallbacks
def test_lift(self):
self._logger.info('Testing manof lift')
image = self._create_manof_image(
image_properties={
'image_name': 'test_image',
'dockerignore': None,
'context': None,
},
image_args={
'repository': None,
'tag_local': None,
})

yield manof.Image.lift(image)

# ensure we tried to provision and run once
image.provision.assert_called_once()
image.run.assert_called_once()

@defer.inlineCallbacks
def test_provision_pull(self):
self._logger.info('Testing manof provision with pull')
Expand All @@ -34,9 +54,6 @@ def test_provision_pull(self):
'tag_local': None,
})

self._logger.debug('Patching image pull method')
self.patch(image, 'pull', mock.Mock())

self._logger.debug('Calling image provisioning')
yield manof.Image.provision(image)

Expand All @@ -54,9 +71,6 @@ def test_provision_build(self):
'dockerfile': 'test_image/Dockerfile'
}
)
self._logger.debug('Patching image pull and _run_command methods')
self.patch(image, 'pull', mock.Mock())
self.patch(image, '_run_command', mock.Mock())

self._logger.debug('Calling image provisioning')
yield manof.Image.provision(image)
Expand Down

0 comments on commit a35eaa3

Please sign in to comment.