Update the test logs generate to generate command logs.
This commit is contained in:
parent
52d2be7953
commit
dee6088b90
1 changed files with 15 additions and 2 deletions
|
@ -97,11 +97,24 @@ def get_fake_repo_build_logs():
|
||||||
adv_total = 110
|
adv_total = 110
|
||||||
lorem_logs = get_sentences(10)
|
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({
|
return jsonify({
|
||||||
'start': adv_start,
|
'start': adv_start,
|
||||||
'end': adv_end,
|
'end': adv_end,
|
||||||
'total': adv_total,
|
'total': adv_total,
|
||||||
'logs': [{'message': sentence} for sentence in lorem_logs]
|
'logs': [wrap_log_message(rnd, sentence) for sentence in lorem_logs]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in a new issue