File: test_exc.py

package info (click to toggle)
python-wsme 0.12.1-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 616 kB
  • sloc: python: 6,064; makefile: 27; javascript: 8
file content (39 lines) | stat: -rw-r--r-- 971 bytes parent folder | download | duplicates (2)
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
33
34
35
36
37
38
39
# encoding=utf8

from wsme.exc import (ClientSideError, InvalidInput, MissingArgument,
                      UnknownArgument)


def test_clientside_error():
    e = ClientSideError("Test")

    assert e.faultstring == "Test"


def test_unicode_clientside_error():
    e = ClientSideError("\u30d5\u30a1\u30b7\u30ea")

    assert e.faultstring == "\u30d5\u30a1\u30b7\u30ea"


def test_invalidinput():
    e = InvalidInput('field', 'badvalue', "error message")

    assert e.faultstring == (
        "Invalid input for field/attribute field. Value: 'badvalue'. "
        "error message"
    ), e.faultstring


def test_missingargument():
    e = MissingArgument('argname', "error message")

    assert e.faultstring == \
        ('Missing argument: "argname": error message'), e.faultstring


def test_unknownargument():
    e = UnknownArgument('argname', "error message")

    assert e.faultstring == \
        ('Unknown argument: "argname": error message'), e.faultstring