New default port: 5311

Change-Id: I74a7fd4e8b808350f5b153ca8cd8dd85cade0827
This commit is contained in:
aviau 2015-07-03 09:10:13 -04:00
parent a6c0d3f889
commit 61c59b730f
16 changed files with 44 additions and 44 deletions

View File

@ -13,8 +13,8 @@ You'll need to provide the Surveil API URL. You can do this with the
``--surveil-api-url`` parameter, but it's easier to just set it as environment
variable::
export SURVEIL_API_URL=http://localhost:8080/v2
export SURVEIL_AUTH_URL=http://localhost:8080/v2/auth
export SURVEIL_API_URL=http://localhost:5311/v2
export SURVEIL_AUTH_URL=http://localhost:5311/v2/auth
You'll find complete documentation on the shell by running ``surveil help``.
@ -31,8 +31,8 @@ Python API
To use the python API, simply create a client with the endpoint::
from surveilclient import client
c = client.Client('http://localhost:8080/v2',
auth_url='http://localhost:8080/v2/auth',
c = client.Client('http://localhost:5311/v2',
auth_url='http://localhost:5311/v2/auth',
version='2_0')
hosts = c.config.hosts.list()

View File

@ -49,7 +49,7 @@ class SurveilShell(object):
parser.add_argument('--surveil-api-url',
default=utils.env(
'SURVEIL_API_URL',
default='http://localhost:8080/v2'),
default='http://localhost:5311/v2'),
help='Defaults to env[SURVEIL_API_URL].')
parser.add_argument('--surveil-api-version',

View File

@ -23,7 +23,7 @@ from surveilclient.common import http
class TestHttp(unittest.TestCase):
def setUp(self):
self.surveil_url = 'http://surveil:8080/v1'
self.surveil_url = 'http://surveil:5311/v1'
self.client = http.HTTPClient(self.surveil_url, authenticated=False)
@httpretty.activate

View File

@ -22,16 +22,16 @@ from surveilclient.v2_0 import client as v2_0_client
class TestClient(unittest.TestCase):
def test_client_default_version(self):
sc = client.Client('http://localhost:8080/sdf',
auth_url='http://localhost:8080/v2/auth')
sc = client.Client('http://localhost:5311/sdf',
auth_url='http://localhost:5311/v2/auth')
self.assertTrue(isinstance(sc, v2_0_client.Client))
def test_client_init_v1(self):
sc = client.Client('http://localhost:8080/v1', version='1_0')
sc = client.Client('http://localhost:5311/v1', version='1_0')
self.assertTrue(isinstance(sc, v1_0_client.Client))
def test_client_init_v2(self):
sc = client.Client('http://localhost:8080/v2',
auth_url='http://localhost:8080/v2/auth',
sc = client.Client('http://localhost:5311/v2',
auth_url='http://localhost:5311/v2/auth',
version='2_0')
self.assertTrue(isinstance(sc, v2_0_client.Client))

View File

@ -22,7 +22,7 @@ class TestAcknowledge(clienttest.ClientTest):
@httpretty.activate
def test_create(self):
httpretty.register_uri(
httpretty.POST, "http://localhost:8080/v2/actions/acknowledge",
httpretty.POST, "http://localhost:5311/v2/actions/acknowledge",
body='{"message": "Ack received!"}')
self.client.actions.acknowledge.create(

View File

@ -22,7 +22,7 @@ class TestDowntime(clienttest.ClientTest):
@httpretty.activate
def test_create(self):
httpretty.register_uri(
httpretty.POST, "http://localhost:8080/v2/actions/downtime",
httpretty.POST, "http://localhost:5311/v2/actions/downtime",
body='{"message": "Ack received!"}')
self.client.actions.downtime.create(

View File

@ -23,7 +23,7 @@ class TestRecheck(clienttest.ClientTest):
@httpretty.activate
def test_create(self):
httpretty.register_uri(
httpretty.POST, "http://localhost:8080/v2/actions/recheck",
httpretty.POST, "http://localhost:5311/v2/actions/recheck",
body='{"message": "Ack received!"}')
self.client.actions.recheck.create(

View File

@ -22,8 +22,8 @@ from surveilclient import client
class ClientTest(unittest.TestCase):
def setUp(self):
self.client = client.Client('http://localhost:8080/v2',
auth_url='http://localhost:8080/v2/auth',
self.client = client.Client('http://localhost:5311/v2',
auth_url='http://localhost:5311/v2/auth',
version='2_0')
# Mock the _get_auth_token call

View File

@ -22,7 +22,7 @@ class TestCheckModulations(clienttest.ClientTest):
@httpretty.activate
def test_create(self):
httpretty.register_uri(
httpretty.POST, "http://localhost:8080/v2/config/checkmodulations",
httpretty.POST, "http://localhost:5311/v2/config/checkmodulations",
body='{"message": "Ack received!"}')
self.client.config.checkmodulations.create(
@ -41,7 +41,7 @@ class TestCheckModulations(clienttest.ClientTest):
@httpretty.activate
def test_list(self):
httpretty.register_uri(
httpretty.GET, "http://localhost:8080/v2/config/checkmodulations",
httpretty.GET, "http://localhost:5311/v2/config/checkmodulations",
body='[{"checkmodulation_name": "test","check_command": "test",'
'"check_period": "test"}]'
)
@ -55,7 +55,7 @@ class TestCheckModulations(clienttest.ClientTest):
@httpretty.activate
def test_delete(self):
httpretty.register_uri(
httpretty.DELETE, "http://localhost:8080/v2/config/"
httpretty.DELETE, "http://localhost:5311/v2/config/"
"checkmodulations/checkmodulation_to_delete",
body='body')

View File

@ -25,7 +25,7 @@ class TestCommands(clienttest.ClientTest):
def test_list(self):
httpretty.register_uri(
httpretty.GET,
"http://localhost:8080/v2/config/commands",
"http://localhost:5311/v2/config/commands",
body='[{"command_name":"myCommand"}]'
)
@ -37,7 +37,7 @@ class TestCommands(clienttest.ClientTest):
@httpretty.activate
def test_create(self):
httpretty.register_uri(
httpretty.POST, "http://localhost:8080/v2/config/commands",
httpretty.POST, "http://localhost:5311/v2/config/commands",
body='{"command_name": "new_command", "command_line": "new_line"}'
)
@ -58,7 +58,7 @@ class TestCommands(clienttest.ClientTest):
def test_show(self):
httpretty.register_uri(
httpretty.GET,
"http://localhost:8080/v2/config/commands/command_to_show",
"http://localhost:5311/v2/config/commands/command_to_show",
body='{"command_name": "command_to_show", "command_line": "line"}'
)
@ -78,7 +78,7 @@ class TestCommands(clienttest.ClientTest):
def test_update(self):
httpretty.register_uri(
httpretty.PUT,
"http://localhost:8080/v2/config/commands/command_to_update",
"http://localhost:5311/v2/config/commands/command_to_update",
body='{"command_line": "updated command_line"}'
)
@ -99,7 +99,7 @@ class TestCommands(clienttest.ClientTest):
def test_delete(self):
httpretty.register_uri(
httpretty.DELETE,
"http://localhost:8080/v2/config/commands/command_to_delete",
"http://localhost:5311/v2/config/commands/command_to_delete",
body="body"
)

View File

@ -24,7 +24,7 @@ class TestHosts(clienttest.ClientTest):
@httpretty.activate
def test_list(self):
httpretty.register_uri(
httpretty.GET, "http://localhost:8080/v2/config/hosts",
httpretty.GET, "http://localhost:5311/v2/config/hosts",
body='[{"host_name": "host1"}]'
)
@ -38,7 +38,7 @@ class TestHosts(clienttest.ClientTest):
@httpretty.activate
def test_create(self):
httpretty.register_uri(
httpretty.POST, "http://localhost:8080/v2/config/hosts",
httpretty.POST, "http://localhost:5311/v2/config/hosts",
body='{"host_name": "new_host", "address": "192.168.2.1"}'
)
@ -59,7 +59,7 @@ class TestHosts(clienttest.ClientTest):
def test_show(self):
httpretty.register_uri(
httpretty.GET,
"http://localhost:8080/v2/config/hosts/host_name_to_show",
"http://localhost:5311/v2/config/hosts/host_name_to_show",
body='{"host_name": "host_name_to_show"}'
)
@ -76,7 +76,7 @@ class TestHosts(clienttest.ClientTest):
def test_update(self):
httpretty.register_uri(
httpretty.PUT,
"http://localhost:8080/v2/config/hosts/host_name_to_update",
"http://localhost:5311/v2/config/hosts/host_name_to_update",
body='{"test": "test"}'
)
@ -99,7 +99,7 @@ class TestHosts(clienttest.ClientTest):
def test_delete(self):
httpretty.register_uri(
httpretty.DELETE,
"http://localhost:8080/v2/config/hosts/host_name_to_delete",
"http://localhost:5311/v2/config/hosts/host_name_to_delete",
body="body"
)

View File

@ -22,7 +22,7 @@ class TestServices(clienttest.ClientTest):
@httpretty.activate
def test_list(self):
httpretty.register_uri(
httpretty.GET, "http://localhost:8080/v2/config/services",
httpretty.GET, "http://localhost:5311/v2/config/services",
body='[{"service_name": "service1"}]'
)
@ -36,7 +36,7 @@ class TestServices(clienttest.ClientTest):
@httpretty.activate
def test_create(self):
httpretty.register_uri(
httpretty.POST, "http://localhost:8080/v2/config/services",
httpretty.POST, "http://localhost:5311/v2/config/services",
body='{"service_name": "new_service"}'
)
@ -53,7 +53,7 @@ class TestServices(clienttest.ClientTest):
def test_delete(self):
httpretty.register_uri(
httpretty.DELETE,
"http://localhost:8080/v2/config/hosts/host_name/" +
"http://localhost:5311/v2/config/hosts/host_name/" +
"services/service_description",
body="body"
)

View File

@ -23,7 +23,7 @@ class TestEvents(clienttest.ClientTest):
@httpretty.activate
def test_list(self):
httpretty.register_uri(
httpretty.POST, "http://localhost:8080/v2/status/events",
httpretty.POST, "http://localhost:5311/v2/status/events",
body='[{"host_name": "sfl.com", "service_description": "cpu", '
'"event_type": "ALERT", "output": "Ok"},'
'{"host_name": "sfl.com", "service_description": "cpu", '
@ -53,7 +53,7 @@ class TestEvents(clienttest.ClientTest):
@httpretty.activate
def test_list_with_live_query(self):
httpretty.register_uri(
httpretty.POST, "http://localhost:8080/v2/status/events",
httpretty.POST, "http://localhost:5311/v2/status/events",
body='[{"host_name": "sfl.com", "service_description": "cpu", '
'"event_type": "ALERT", "output": "Ok"},'
'{"host_name": "sfl.com", "service_description": "cpu", '

View File

@ -24,7 +24,7 @@ class TestHosts(clienttest.ClientTest):
@httpretty.activate
def test_list(self):
httpretty.register_uri(
httpretty.POST, "http://localhost:8080/v2/status/hosts",
httpretty.POST, "http://localhost:5311/v2/status/hosts",
body='[{"host_name": "host1"}]'
)
@ -38,7 +38,7 @@ class TestHosts(clienttest.ClientTest):
@httpretty.activate
def test_get(self):
httpretty.register_uri(
httpretty.GET, "http://localhost:8080/v2/status/hosts/hostname",
httpretty.GET, "http://localhost:5311/v2/status/hosts/hostname",
body='{"host_name": "host1"}'
)
@ -52,7 +52,7 @@ class TestHosts(clienttest.ClientTest):
@httpretty.activate
def test_submit_host_check_result(self):
httpretty.register_uri(
httpretty.POST, "http://localhost:8080/v2/status/hosts/localhost"
httpretty.POST, "http://localhost:5311/v2/status/hosts/localhost"
"/results",
body=''
)

View File

@ -22,7 +22,7 @@ class TestMetrics(clienttest.ClientTest):
@httpretty.activate
def test_list_metrics(self):
httpretty.register_uri(
httpretty.POST, "http://localhost:8080/v2/status/"
httpretty.POST, "http://localhost:5311/v2/status/"
"hosts/localhost/metrics/load1",
body='[{"min": "2", "warning": "15", "value": "3"},'
'{"min": "5", "warning": "200", "value": "150"}]'
@ -43,7 +43,7 @@ class TestMetrics(clienttest.ClientTest):
@httpretty.activate
def test_list_service(self):
httpretty.register_uri(
httpretty.POST, "http://localhost:8080/v2/status/hosts/localhost"
httpretty.POST, "http://localhost:5311/v2/status/hosts/localhost"
"/services/load/metrics/load1",
body='[{"min": "2", "warning": "15", "value": "3"},'
'{"min": "5", "warning": "200", "value": "150"}]'
@ -64,7 +64,7 @@ class TestMetrics(clienttest.ClientTest):
@httpretty.activate
def test_show(self):
httpretty.register_uri(
httpretty.GET, "http://localhost:8080/v2/status/hosts/localhost"
httpretty.GET, "http://localhost:5311/v2/status/hosts/localhost"
"/metrics/load1",
body='{"min": "2", "warning": "15", "value": "3"}'
)
@ -79,7 +79,7 @@ class TestMetrics(clienttest.ClientTest):
@httpretty.activate
def test_show_service(self):
httpretty.register_uri(
httpretty.GET, "http://localhost:8080/v2/status/hosts/localhost"
httpretty.GET, "http://localhost:5311/v2/status/hosts/localhost"
"/services/load/metrics/load1",
body='{"min": "2", "warning": "15", "value": "3"}'
)
@ -95,7 +95,7 @@ class TestMetrics(clienttest.ClientTest):
@httpretty.activate
def test_list_metrics_name(self):
httpretty.register_uri(
httpretty.GET, "http://localhost:8080/v2/status/hosts/localhost"
httpretty.GET, "http://localhost:5311/v2/status/hosts/localhost"
"/metrics",
body='[{"metric_name": "rta"},{"metric_name": "load5"}]'
)

View File

@ -24,7 +24,7 @@ class TestServices(clienttest.ClientTest):
@httpretty.activate
def test_list(self):
httpretty.register_uri(
httpretty.POST, "http://localhost:8080/v2/status/services",
httpretty.POST, "http://localhost:5311/v2/status/services",
body='[{"service_name": "service1"}]'
)
@ -39,7 +39,7 @@ class TestServices(clienttest.ClientTest):
def test_submit_service_check_result(self):
httpretty.register_uri(
httpretty.POST,
"http://localhost:8080/v2/status/hosts/localhost"
"http://localhost:5311/v2/status/hosts/localhost"
"/services/testservice/results",
body=''
)