File: test_create.py

package info (click to toggle)
iottycloud 0.3.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 180 kB
  • sloc: python: 294; makefile: 3
file content (32 lines) | stat: -rw-r--r-- 959 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
27
28
29
30
31
32
"""Test for creation of CloudApi proxy."""
import requests

from .helpers import CloudApiConcrete

def test_creation_noparams_ws_error():
    """No 'WS' param causing errors."""
    try:
        _ = CloudApiConcrete(None, "host", "client_id")
    except ValueError as excinfo:
        assert str(excinfo) == "websession"

def test_creation_noparams_host_error():
    """No 'host' param causing errors."""
    try:
        _ = CloudApiConcrete(requests.Session(), None, "client_id")
    except ValueError as excinfo:
        assert str(excinfo) == "host"

def test_creation_noparams_clientid_error():
    """No 'clientid' param causing errors."""
    try:
        _ = CloudApiConcrete(requests.Session(), "host", None)
    except ValueError as excinfo:
        assert str(excinfo) == "client_id"

def test_creation_ok():
    """Creation completed succesfully."""

    sut = CloudApiConcrete(requests.Session(), "host", "client_id")

    assert sut is not None