make_principal ready for testing