Browse Source

Replace duplicated URL in tests with a variable

tags/nilmdb-1.1^2
Jim Paris 9 years ago
parent
commit
ee24380d1f
1 changed files with 9 additions and 8 deletions
  1. +9
    -8
      tests/test_client.py

+ 9
- 8
tests/test_client.py View File

@@ -23,6 +23,7 @@ import time
from testutil.helpers import *

testdb = "tests/client-testdb"
testurl = "http://localhost:12380/"

def setup_module():
global test_server, test_db
@@ -70,7 +71,7 @@ class TestClient(object):
client.close()

# Now use the real URL
client = nilmdb.Client(url = "http://localhost:12380/")
client = nilmdb.Client(url = testurl)
version = client.version()
eq_(distutils.version.LooseVersion(version),
distutils.version.LooseVersion(test_server.version))
@@ -82,7 +83,7 @@ class TestClient(object):

def test_client_02_createlist(self):
# Basic stream tests, like those in test_nilmdb:test_stream
client = nilmdb.Client(url = "http://localhost:12380/")
client = nilmdb.Client(url = testurl)

# Database starts empty
eq_(client.stream_list(), [])
@@ -125,7 +126,7 @@ class TestClient(object):
client.close()

def test_client_03_metadata(self):
client = nilmdb.Client(url = "http://localhost:12380/")
client = nilmdb.Client(url = testurl)

# Set / get metadata
eq_(client.stream_get_metadata("/newton/prep"), {})
@@ -159,7 +160,7 @@ class TestClient(object):
client.close()

def test_client_04_insert(self):
client = nilmdb.Client(url = "http://localhost:12380/")
client = nilmdb.Client(url = testurl)

datetime_tz.localtz_set("America/New_York")

@@ -237,7 +238,7 @@ class TestClient(object):

def test_client_05_extractremove(self):
# Misc tests for extract and remove. Most of them are in test_cmdline.
client = nilmdb.Client(url = "http://localhost:12380/")
client = nilmdb.Client(url = testurl)

for x in client.stream_extract("/newton/prep", 123, 123):
raise AssertionError("shouldn't be any data for this request")
@@ -250,7 +251,7 @@ class TestClient(object):
def test_client_06_generators(self):
# A lot of the client functionality is already tested by test_cmdline,
# but this gets a bit more coverage that cmdline misses.
client = nilmdb.Client(url = "http://localhost:12380/")
client = nilmdb.Client(url = testurl)

# Trigger a client error in generator
start = datetime_tz.datetime_tz.smartparse("20120323T2000")
@@ -304,7 +305,7 @@ class TestClient(object):
# Pokes around in client.http internals a bit to look at the
# response headers.

client = nilmdb.Client(url = "http://localhost:12380/")
client = nilmdb.Client(url = testurl)
http = client.http

# Use a warning rather than returning a test failure, so that we can
@@ -341,7 +342,7 @@ class TestClient(object):

def test_client_08_unicode(self):
# Basic Unicode tests
client = nilmdb.Client(url = "http://localhost:12380/")
client = nilmdb.Client(url = testurl)

# Delete streams that exist
for stream in client.stream_list():


Loading…
Cancel
Save