Fixed tests and flake8 issues #2819

Review ID: 498002