Update the test logs generate to generate command logs.

This commit is contained in:
yackob03 2014-02-10 15:10:53 -05:00
parent 52d2be7953
commit dee6088b90

View file

@ -37,7 +37,7 @@ def generate_fake_status():
'complete': {},
'building': {
'total_commands': 7,
'current_command': random.randint(1, 7),
'current_command': random.randint(1, 7),
},
'pushing': {
'total_commands': 7,
@ -97,11 +97,24 @@ def get_fake_repo_build_logs():
adv_total = 110
lorem_logs = get_sentences(10)
def wrap_log_message(rand, msg):
if rand.randint(1, 10) == 1:
block = {
'is_command': True,
'message': 'Step %s : %s' % (rand.randint(1, 10), msg)
}
else:
block = {
'message': msg,
}
return block
rnd = SystemRandom()
return jsonify({
'start': adv_start,
'end': adv_end,
'total': adv_total,
'logs': [{'message': sentence} for sentence in lorem_logs]
'logs': [wrap_log_message(rnd, sentence) for sentence in lorem_logs]
})