+ return foo
+
+
+def run_expiration_test(ctx: Test) -> None:
+ """Make sure that invites can't be used after expiration date."""
+
+ foo, bar = init(ctx), ctx.node()
+ foo.cmd("set", "InvitationExpire", "1")
+ foo.start()
+
+ url, _ = foo.cmd("invite", bar.name)
+ url = url.strip()
+ time.sleep(2)
+
+ try:
+ bar.cmd("join", url, code=1, timeout=1)
+ except subp.TimeoutExpired:
+ pass
+
+ foo.cmd("stop")
+ foo_log = util.read_text(foo.sub("log"))
+ check.is_in("tried to use expired invitation", foo_log)
+
+
+def run_invite_test(ctx: Test, start_before_invite: bool) -> None:
+ """Run tests. If start_before_invite is True,
+ tincd is started *before* creating invitation, and vice versa.
+ """
+ foo = init(ctx)
+ bar = ctx.node()