File: test_stem.py

package info (click to toggle)
sbws 2.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 16,084 kB
  • sloc: python: 10,432; sh: 146; makefile: 38
file content (28 lines) | stat: -rw-r--r-- 954 bytes parent folder | download | duplicates (6)
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
import sbws.util.stem as stem_utils


def test_launch_and_okay(persistent_launch_tor):
    cont = persistent_launch_tor
    assert stem_utils.is_bootstrapped(cont)


def test_set_torrc_runtime_option_succesful(persistent_launch_tor):
    controller = persistent_launch_tor
    runtime_options = controller.get_conf_map(["__LeaveStreamsUnattached"])
    assert runtime_options == {"__LeaveStreamsUnattached": ["1"]}


def test_set_torrc_runtime_invalidrequest_option_fail(persistent_launch_tor):
    controller = persistent_launch_tor
    try:
        controller.set_conf("ControlSocket", "/tmp/dummy")
    except stem_utils.InvalidRequest as e:
        assert "Unable to set option" in e.message


def test_set_torrc_options_can_fail_option_fail(persistent_launch_tor):
    controller = persistent_launch_tor
    try:
        controller.set_conf("BadOption", "0")
    except stem_utils.InvalidArguments as e:
        assert "Unknown option" in e.message