Skip to content

Commit

Permalink
Fix bad implementation of set_auto_accept_follow on FediverseNode
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannes Ernst committed Oct 15, 2024
1 parent 99aefcd commit 9a762b6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
7 changes: 3 additions & 4 deletions src/feditest/nodedrivers/mastodon/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,6 @@ def __init__(self, rolename: str, config: NodeConfiguration, account_manager: Ac
# The request.Session with the custom certificate authority set as verifier.
# Allocated when needed, so our custom certificate authority has been created before this is used.

self._auto_accept_follow = auto_accept_follow # True is default for Mastodon


# From FediverseNode

Expand Down Expand Up @@ -333,8 +331,9 @@ def make_follow(self, actor_acct_uri: str, to_follow_actor_acct_uri: str) -> Non

# Python 3.12 @override
def set_auto_accept_follow(self, actor_acct_uri: str, auto_accept_follow: bool = True) -> None:
if self._auto_accept_follow == auto_accept_follow:
return
if auto_accept_follow:
return # Default for Mastodon

raise NotImplementedByNodeError(self, NodeWithMastodonAPI.set_auto_accept_follow) # Can't find an API call for this


Expand Down
3 changes: 3 additions & 0 deletions src/feditest/protocols/fediverse/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ def set_auto_accept_follow(self, actor_acct_uri: str, auto_accept_follow: bool =
if they do not have the requested behavior (or it cannot be scripted) and
the corresponding tests does not run.
"""
if auto_accept_follow:
return # Assumed default

raise NotImplementedByNodeError(self, FediverseNode.set_auto_accept_follow)


Expand Down
2 changes: 1 addition & 1 deletion tests.smoke/tests/nodes_with_mastodon_api_communicate.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ def __init__(self,
) -> None:
self.leader_node = leader_node
self.leader_actor_acct_uri = None
self.leader_node.set_auto_accept_follow(True)

self.follower_node = follower_node
self.follower_actor_acct_uri = None
Expand All @@ -29,6 +28,7 @@ def __init__(self,
def provision_actors(self):
self.leader_actor_acct_uri = self.leader_node.obtain_actor_acct_uri()
assert self.leader_actor_acct_uri
self.leader_node.set_auto_accept_follow(self.leader_actor_acct_uri, True)

self.follower_actor_acct_uri = self.follower_node.obtain_actor_acct_uri()
assert self.follower_actor_acct_uri
Expand Down

0 comments on commit 9a762b6

Please sign in to comment.