|
|
@@ -45,7 +45,7 @@ def teardown_module(): |
|
|
|
|
|
|
|
class TestClient(object): |
|
|
|
|
|
|
|
def test_client_1_basic(self): |
|
|
|
def test_client_01_basic(self): |
|
|
|
# Test a fake host |
|
|
|
client = nilmdb.Client(url = "http://localhost:1/") |
|
|
|
with assert_raises(nilmdb.client.ServerError): |
|
|
@@ -80,7 +80,7 @@ class TestClient(object): |
|
|
|
client.http.get("/stream/create") |
|
|
|
client.close() |
|
|
|
|
|
|
|
def test_client_2_createlist(self): |
|
|
|
def test_client_02_createlist(self): |
|
|
|
# Basic stream tests, like those in test_nilmdb:test_stream |
|
|
|
client = nilmdb.Client(url = "http://localhost:12380/") |
|
|
|
|
|
|
@@ -124,7 +124,7 @@ class TestClient(object): |
|
|
|
|
|
|
|
client.close() |
|
|
|
|
|
|
|
def test_client_3_metadata(self): |
|
|
|
def test_client_03_metadata(self): |
|
|
|
client = nilmdb.Client(url = "http://localhost:12380/") |
|
|
|
|
|
|
|
# Set / get metadata |
|
|
@@ -158,7 +158,7 @@ class TestClient(object): |
|
|
|
client.stream_update_metadata("/newton/prep", [1,2,3]) |
|
|
|
client.close() |
|
|
|
|
|
|
|
def test_client_4_insert(self): |
|
|
|
def test_client_04_insert(self): |
|
|
|
client = nilmdb.Client(url = "http://localhost:12380/") |
|
|
|
|
|
|
|
datetime_tz.localtz_set("America/New_York") |
|
|
@@ -235,7 +235,7 @@ class TestClient(object): |
|
|
|
|
|
|
|
client.close() |
|
|
|
|
|
|
|
def test_client_5_extractremove(self): |
|
|
|
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/") |
|
|
|
|
|
|
@@ -247,7 +247,7 @@ class TestClient(object): |
|
|
|
|
|
|
|
client.close() |
|
|
|
|
|
|
|
def test_client_6_generators(self): |
|
|
|
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/") |
|
|
@@ -298,7 +298,7 @@ class TestClient(object): |
|
|
|
|
|
|
|
client.close() |
|
|
|
|
|
|
|
def test_client_7_headers(self): |
|
|
|
def test_client_07_headers(self): |
|
|
|
# Make sure that /stream/intervals and /stream/extract |
|
|
|
# properly return streaming, chunked, text/plain response. |
|
|
|
# Pokes around in client.http internals a bit to look at the |
|
|
@@ -339,7 +339,7 @@ class TestClient(object): |
|
|
|
|
|
|
|
client.close() |
|
|
|
|
|
|
|
def test_client_8_unicode(self): |
|
|
|
def test_client_08_unicode(self): |
|
|
|
# Basic Unicode tests |
|
|
|
client = nilmdb.Client(url = "http://localhost:12380/") |
|
|
|
|
|
|
@@ -378,7 +378,7 @@ class TestClient(object): |
|
|
|
|
|
|
|
client.close() |
|
|
|
|
|
|
|
def test_client_9_closing(self): |
|
|
|
def test_client_09_closing(self): |
|
|
|
# Make sure we actually close sockets correctly. New |
|
|
|
# connections will block for a while if they're not, since the |
|
|
|
# server will stop accepting new connections. |
|
|
|