Add additional asserts
@@ -78,6 +78,17 @@ class TestLocalBuildEnvironment(TestCase):
# api() is not called anymore, we use api_v2 instead
self.assertFalse(self.mocks.api()(DUMMY_BUILD_ID).put.called)
+ # The command was saved
+ command = build_env.commands[0]
+ self.mocks.mocks['api_v2.command'].post.assert_called_once_with({
+ 'build': DUMMY_BUILD_ID,
+ 'command': command.get_command(),
+ 'description': command.description,
+ 'output': command.output,
+ 'exit_code': 0,
+ 'start_time': command.start_time,
+ 'end_time': command.end_time,
+ })
self.mocks.mocks['api_v2.build']().put.assert_called_with({
'id': DUMMY_BUILD_ID,
'version': self.version.pk,
@@ -151,6 +162,17 @@ class TestLocalBuildEnvironment(TestCase):
# api() is not called anymore, we use api_v2 instead
self.assertFalse(self.mocks.api()(DUMMY_BUILD_ID).put.called)
+ # The command was saved
+ command = build_env.commands[0]
+ self.mocks.mocks['api_v2.command'].post.assert_called_once_with({
+ 'build': DUMMY_BUILD_ID,
+ 'command': command.get_command(),
+ 'description': command.description,
+ 'output': command.output,
+ 'exit_code': 1,
+ 'start_time': command.start_time,
+ 'end_time': command.end_time,
+ })
self.mocks.mocks['api_v2.build']().put.assert_called_with({
'id': DUMMY_BUILD_ID,
'version': self.version.pk,
@@ -184,6 +206,8 @@ class TestLocalBuildEnvironment(TestCase):
# api() is not called anymore, we use api_v2 instead
self.assertFalse(self.mocks.api()(DUMMY_BUILD_ID).put.called)
+ # The command was not saved
+ self.mocks.mocks['api_v2.command'].post.assert_not_called()
self.mocks.mocks['api_v2.build']().put.assert_called_with({
'id': DUMMY_BUILD_ID,
'version': self.version.pk,
@@ -216,6 +240,8 @@ class TestLocalBuildEnvironment(TestCase):
# api() is not called anymore, we use api_v2 instead
self.assertFalse(self.mocks.api()(DUMMY_BUILD_ID).put.called)
+ # The command was not saved
+ self.mocks.mocks['api_v2.command'].post.assert_not_called()
self.mocks.mocks['api_v2.build']().put.assert_called_with({
'id': DUMMY_BUILD_ID,
'version': self.version.pk,
