def agent_auth_info(): agent_data = os.environ.get('TEST_AGENTS') if agent_data is None: pytest.skip('skipping macaroon_auth because no TEST_AGENTS ' 'environment variable is set') auth_info = agent.read_auth_info(agent_data) if len(auth_info.agents) != 1: raise Exception('TEST_AGENTS agent data requires exactly one agent') return auth_info, auth_info.agents[0].username
def test_invalid_read_auth_info_arg(self): with self.assertRaises(agent.AgentFileFormatError): agent.read_auth_info(0)
def test_invalid_agent_json(self): with self.assertRaises(agent.AgentFileFormatError): agent.read_auth_info('}')