Create unit tests #3

Merged
tormakris merged 9 commits from testing into master 2020-03-31 21:49:57 +02:00
Showing only changes of commit 7d19ec0fa8 - Show all commits

View File

@ -140,8 +140,7 @@ def test_learnconsumerlist(httpserver):
httpserver.expect_request( httpserver.expect_request(
uri="/consumer", uri="/consumer",
method='GET', method='GET',
data="", data="").respond_with_json(
handler_type='permanent').respond_with_json(
["10.69.42.1", "10.10.10.10", "10.20.30.40"]) ["10.69.42.1", "10.10.10.10", "10.20.30.40"])
url = httpserver.url_for("/") url = httpserver.url_for("/")
port = re.match(r"\W*http[^:]*\D*(\d+)", url).group(1) port = re.match(r"\W*http[^:]*\D*(\d+)", url).group(1)
@ -198,7 +197,6 @@ def test_updateconsumer(httpserver):
locator = consumerlocator.ConsumerLocator( locator = consumerlocator.ConsumerLocator(
uuid=generateduuid, communicator=comm) uuid=generateduuid, communicator=comm)
assert locator.currentconsumer is not None assert locator.currentconsumer is not None
locator.learnconsumerlist();
ret = locator.updateconsumer() ret = locator.updateconsumer()
assert ret == f"127.0.0.1:{port}" assert ret == f"127.0.0.1:{port}"