fuel-ostf/fuel_plugin/testing/test_utils/cluster_id.py
Artem Roma fdf8007eab Unittests refactoring for ci
Logic that supports automated execution of unit tests for ci purpose
were added via setUp/tearDownPackage functions in
testing/tests/__init__.py file. Now when tests started via nose in
package setUp function nailgunmimic server is setting up in separate
process and terminating in tearDown. This functionality provides unified
way to execute unit tests.

Change-Id: I4a033757c8d902c90b0a6c7eb54c1511ab721f99
2013-11-22 18:55:46 +02:00

22 lines
380 B
Python

#!/usr/bin/env python
# -*- coding: utf-8 -*-
from requests import get
import sys
def main():
try:
r = get('http://localhost:8000/api/clusters').json()
except IOError or ValueError as e:
print e.message
return 1
cluster_id = next(item['id'] for item in r)
print cluster_id
return 0
if __name__ == '__main__':
sys.exit(main())