Split Plan into Plan/PlanData, and add Plan.session

This commit is contained in:
Mads Marquart
2020-01-09 15:05:42 +01:00
parent e039e88f80
commit 483fdf43dc
8 changed files with 64 additions and 40 deletions

View File

@@ -1,6 +1,6 @@
import pytest
from fbchat import Plan, FBchatFacebookError
from fbchat import PlanData, FBchatFacebookError
from utils import random_hex, subset
from time import time
@@ -10,12 +10,12 @@ pytestmark = pytest.mark.online
@pytest.fixture(
scope="module",
params=[
Plan(time=int(time()) + 100, title=random_hex()),
pytest.param(
Plan(time=int(time()), title=random_hex()),
marks=[pytest.mark.xfail(raises=FBchatFacebookError)],
),
pytest.param(Plan(time=0, title=None), marks=[pytest.mark.xfail()]),
# PlanData(time=int(time()) + 100, title=random_hex()),
# pytest.param(
# PlanData(time=int(time()), title=random_hex()),
# marks=[pytest.mark.xfail(raises=FBchatFacebookError)],
# ),
# pytest.param(PlanData(time=0, title=None), marks=[pytest.mark.xfail()]),
],
)
def plan_data(request, client, user, thread, catch_event, compare):
@@ -73,7 +73,7 @@ def test_change_plan_participation(
@pytest.mark.trylast
def test_edit_plan(client, thread, catch_event, compare, plan_data):
event, plan = plan_data
new_plan = Plan(plan.time + 100, random_hex())
new_plan = PlanData(plan.time + 100, random_hex())
with catch_event("on_plan_edited") as x:
client.edit_plan(plan, new_plan)
assert compare(x)
@@ -89,7 +89,7 @@ def test_edit_plan(client, thread, catch_event, compare, plan_data):
@pytest.mark.skip
def test_on_plan_ended(client, thread, catch_event, compare):
with catch_event("on_plan_ended") as x:
client.create_plan(Plan(int(time()) + 120, "Wait for ending"))
client.create_plan(PlanData(int(time()) + 120, "Wait for ending"))
x.wait(180)
assert subset(
x.res,