Beispiel #1
0
def test_base_read_config():
    user = User()
    user.config_path = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                                    "../synapse_test/api.cfg")
    user.modify_config("invalid", 80, "invalid", "http://", True)
    user.read_config(user.config_path)
    assert user.server_addr == "invalid"
    assert user.server_port == 80
    assert user.access_token == "invalid"
Beispiel #2
0
def test_base_modify_config():
    user = User()
    user.modify_config("invalid", 80, "invalid", "http://", False)
    with pytest.raises(ConnectError):
        user.lists()
    assert isinstance(User().lists(), Contents)
    user.modify_config("invalid", 80, "invalid", "http://", True)
    with pytest.raises(ConnectError):
        user.lists()
        User().lists()
    assert user.modify_config("localhost", 8008, admin_access_token, "http://")
    assert isinstance(user.lists(), Contents)
    assert isinstance(User().lists(), Contents)