Refactor the overcloud views tests

Move the repeated parts of tests to a separate function.

Change-Id: I45cd89b72857202a205609c65b3a9a545982beee
Merge "Refactor the overcloud views tests"