File: test_connection.py

package info (click to toggle)
python-aioruckus 0.40-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 232 kB
  • sloc: python: 1,884; makefile: 6
file content (26 lines) | stat: -rw-r--r-- 755 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
"""Test connecting to a device and issuing commands."""
import pytest

from aioruckus.exceptions import AuthenticationError
from tests import connect_ruckus


@pytest.mark.asyncio
async def test_connect_success():
    """Normal connection / disconnection."""
    async with connect_ruckus() as ruckus:
        pass

@pytest.mark.asyncio
async def test_authentication_error():
    """Invalid login."""
    with pytest.raises(AuthenticationError):
        async with connect_ruckus(password="bad-password") as ruckus:
            pass

@pytest.mark.asyncio
async def test_connection_error():
    """Non- Unleashed/ZoneDirector host."""
    with pytest.raises(ConnectionError):
        async with connect_ruckus(host="127.0.0.1") as ruckus:
            pass