Replace try...except...pass block with assertRaises

To make the test logic looks tidy and clean.

Change-Id: Id278524a8d4b8bf953f6c3d250e47be04c5edb55
Merge "Replace try...except...pass block with assertRaises"