update travis and appveyor configs
update travis and appveyor configs to run pytest instead of nosetests
This commit is contained in:
parent
615c6011ed
commit
bcafa83c65
4 changed files with 34 additions and 4 deletions
|
|
@ -9,4 +9,4 @@ install:
|
|||
- pip install pipenv
|
||||
- pipenv install --dev
|
||||
|
||||
script: nosetests
|
||||
script: pipenv run python -m pytest
|
||||
|
|
|
|||
|
|
@ -19,4 +19,4 @@ test_script:
|
|||
# Note that you must use the environment variable %PYTHON% to refer to
|
||||
# the interpreter you're using - Appveyor does not do anything special
|
||||
# to put the Python version you want to use on PATH.
|
||||
- "pipenv run nosetests"
|
||||
- "pipenv run python -m pytest"
|
||||
|
|
|
|||
|
|
@ -48,7 +48,6 @@ async def main():
|
|||
xmpp_address = (listen_host, 5223)
|
||||
mqtt_address = (listen_host, 8883)
|
||||
|
||||
|
||||
mqtt_server = bumper.MQTTServer(mqtt_address)
|
||||
mqtt_helperbot = bumper.MQTTHelperBot(mqtt_address)
|
||||
conf_server = bumper.ConfServer(
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ def mock_transport_extra_info(*args, **kwargs):
|
|||
return ("127.0.0.1", 1234)
|
||||
|
||||
|
||||
async def test_client(*args, **kwargs):
|
||||
async def test_client_init(*args, **kwargs):
|
||||
test_transport = asyncio.Transport()
|
||||
test_transport.get_extra_info = mock.Mock(return_value=mock_transport_extra_info())
|
||||
test_transport.write = mock.Mock(return_value=return_send_data)
|
||||
|
|
@ -46,3 +46,34 @@ async def test_client(*args, **kwargs):
|
|||
# Reset mock calls
|
||||
mock_send.reset_mock()
|
||||
|
||||
|
||||
async def test_bot_init(*args, **kwargs):
|
||||
test_transport = asyncio.Transport()
|
||||
test_transport.get_extra_info = mock.Mock(return_value=mock_transport_extra_info())
|
||||
test_transport.write = mock.Mock(return_value=return_send_data)
|
||||
xmppclient = bumper.xmppserver.XMPPAsyncClient(test_transport)
|
||||
xmppclient.state = xmppclient.INIT # Set client state to INIT
|
||||
mock_send = xmppclient.send = mock.Mock(side_effect=return_send_data)
|
||||
|
||||
# Send init connect stream from "client"
|
||||
test_data = "<stream:stream xmlns:stream='http://etherx.jabber.org/streams' xmlns='jabber:client' to='159.ecorobot.net' version='1.0'>".encode(
|
||||
"utf-8"
|
||||
)
|
||||
xmppclient._parse_data(test_data)
|
||||
|
||||
# Expect 2 calls to send
|
||||
assert mock_send.call_count == 2
|
||||
# Server opens stream
|
||||
assert (
|
||||
mock_send.mock_calls[0].args[0]
|
||||
== '<stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" version="1.0" id="1" from="ecouser.net">'
|
||||
)
|
||||
# Server tells client available features
|
||||
assert (
|
||||
mock_send.mock_calls[1].args[0]
|
||||
== '<stream:features><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"/><session xmlns="urn:ietf:params:xml:ns:xmpp-session"/></stream:features>'
|
||||
)
|
||||
|
||||
# Reset mock calls
|
||||
mock_send.reset_mock()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue