added testing of 'write_to_cert' method