library/test: make test compatible with Python 2.6
library/test: make test compatible with Python 2.6

unittest.TestCase.assertRaises() with a context manager was only
added in Python 2.6. Rework the code for 2.6 compatiblity.

linux-system-roles/network,linux-system-roles/network,linux-system-roles/network