def test_do_pod_create_with_bay_in_wrong_status(self): client_mock = mock.MagicMock() bay = mock.MagicMock() bay.uuid = 'uuid' bay.status = 'XXX' client_mock.bays.get.return_value = bay args = mock.MagicMock() manifest_url = "test_url" args.manifest_url = manifest_url bay_id_or_name = "xxx" args.bay = bay_id_or_name manifest = "test_manifest" args.manifest = manifest shell.do_pod_create(client_mock, args) self.assertFalse(client_mock.pods.create.called)
def test_do_pod_create(self): client_mock = mock.MagicMock() bay = mock.MagicMock() bay.uuid = 'uuid' bay.status = 'CREATE_COMPLETE' client_mock.bays.get.return_value = bay args = mock.MagicMock() manifest_url = "test_url" args.manifest_url = manifest_url bay_id_or_name = "xxx" args.bay = bay_id_or_name manifest = "test_manifest" args.manifest = manifest shell.do_pod_create(client_mock, args) client_mock.pods.create.assert_called_once_with( manifest_url=manifest_url, bay_uuid=bay.uuid)