[ATR-20780] Avoid Python crash on empty menu in testing units
Some MT trigger tests use an empty menu.
This prevents the JSONification code from crashing in these cases.
Some MT trigger tests use an empty menu.
This prevents the JSONification code from crashing in these cases.