예제 #1
0
def test_get_session_id_for_client_not_there():
    manager = SessionManager()
    manager.get_sessions_list = MagicMock(return_value=[])

    id = manager.get_session_id_for_client("name")

    assert id is None
예제 #2
0
def test_get_session_id_for_client():
    manager = SessionManager()
    manager.get_sessions_list = MagicMock(return_value=["name"])
    manager._sessions["name"] = MagicMock()

    id = manager.get_session_id_for_client("name")

    assert id is not None
예제 #3
0
def test_client_names_returned():
    client = MagicMock()
    manager = SessionManager()

    manager.add_session("name0", client)
    manager.add_session("name1", client)

    assert_equals({"name0", "name1"}, set(manager.get_sessions_list()))