Skip to content
This repository was archived by the owner on May 6, 2020. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions rootfs/api/tests/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,19 @@ def test_app_logs(self, mock_requests, mock_get):
@mock.patch('api.models.logger')
def test_app_release_notes_in_logs(self, mock_requests, mock_logger):
"""Verifies that an app's release summary is dumped into the logs."""
self.create_app()
app_id = self.create_app()
app = App.objects.get(id=app_id)

# check app logs
exp_msg = "autotest created initial release"
exp_log_call = mock.call(logging.INFO, exp_msg)
mock_logger.log.has_calls(exp_log_call)
exp_msg = "[{app_id}]: {self.user.username} created initial release".format(**locals())
mock_logger.log.has_calls(logging.INFO, exp_msg)
app.log('hello world')
exp_msg = "[{app_id}]: hello world".format(**locals())
mock_logger.log.has_calls(logging.INFO, exp_msg)
app.log('goodbye world', logging.WARNING)
# assert logging with a different log level
exp_msg = "[{app_id}]: goodbye world".format(**locals())
mock_logger.log.has_calls(logging.WARNING, exp_msg)

def test_app_errors(self, mock_requests):
response = self.client.post('/v2/apps', {'id': 'camelCase'})
Expand Down