def test_get_machines_no_ready(self): s = MaasState(self.mock_client_bootstrap_only) all_machines = s.machines() self.assertEqual(all_machines, []) ready_machines = s.machines(MaasMachineStatus.READY) self.assertEqual(ready_machines, []) s2 = MaasState(self.mock_client_onedeclared) all_machines = s2.machines() self.assertEqual(len(all_machines), 1) ready_machines = s2.machines(MaasMachineStatus.READY) self.assertEqual(ready_machines, [])
def test_get_machines_one_ready(self): s = MaasState(self.mock_client_oneready) ready_machines = s.machines(MaasMachineStatus.READY) self.assertEqual(len(ready_machines), 1)
def authenticate_maas(self): auth = MaasAuth() auth.get_api_key('root') self.maas = MaasClient(auth) self.maas_state = MaasState(self.maas) log.debug('Authenticated against maas api.')