Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename WordPress Driver #378

Merged
merged 2 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/feditest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,8 @@ def load_default_node_drivers() -> None:
'feditest.nodedrivers.sandbox.SandboxMultClientDriver_ImplementationA',
'feditest.nodedrivers.sandbox.SandboxMultServerDriver_Implementation1',
'feditest.nodedrivers.sandbox.SandboxMultServerDriver_Implementation2Faulty',
'feditest.nodedrivers.wordpress.WordPressPlusActivityPubPluginSaasNodeDriver',
'feditest.nodedrivers.wordpress.ubos.WordPressPlusActivityPubPluginUbosNodeDriver']:
'feditest.nodedrivers.wordpress.WordPressPlusPluginsSaasNodeDriver',
'feditest.nodedrivers.wordpress.ubos.WordPressPlusPluginsUbosNodeDriver']:

module_name, class_name = d.rsplit('.', 1)
if class_name not in all_node_drivers:
Expand Down
1 change: 1 addition & 0 deletions src/feditest/cli/commands/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def run(parser: ArgumentParser, args: Namespace, remaining: list[str]) -> int:

if not plan:
fatal('Cannot find or create test plan ')
return 1 # make linter happy

if not plan.is_compatible_type():
warning(f'Test plan has unexpected type { plan.type }: incompatibilities may occur.')
Expand Down
8 changes: 4 additions & 4 deletions src/feditest/nodedrivers/wordpress/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def _ensure_oauth_token(self, oauth_client_id: str) -> None:
"""
if self._oauth_token:
return
real_node = cast(WordPressPlusActivityPubPluginNode, self._node)
real_node = cast(WordPressPlusPluginsNode, self._node)
self._oauth_token = real_node._provision_oauth_token_for(self, oauth_client_id)


Expand Down Expand Up @@ -164,7 +164,7 @@ def actor_uri(self):
return f'https://{ self.node.hostname }/users/{ self.userid }'


class WordPressPlusActivityPubPluginNode(NodeWithMastodonAPI):
class WordPressPlusPluginsNode(NodeWithMastodonAPI):
"""
A Node running WordPress with the ActivityPub plugin.
"""
Expand All @@ -183,7 +183,7 @@ def _provision_oauth_token_for(self, account: WordPressAccount, oauth_client_id:
return ret


class WordPressPlusActivityPubPluginSaasNodeDriver(NodeDriver):
class WordPressPlusPluginsSaasNodeDriver(NodeDriver):
"""
Create a WordPress + ActivityPubPlugin Node that already runs as Saas
"""
Expand Down Expand Up @@ -245,4 +245,4 @@ def create_configuration_account_manager(self, rolename: str, test_plan_node: Te

# Python 3.12 @override
def _provision_node(self, rolename: str, config: NodeConfiguration, account_manager: AccountManager | None) -> FediverseNode:
return WordPressPlusActivityPubPluginNode(rolename, config, cast(AccountManager, account_manager))
return WordPressPlusPluginsNode(rolename, config, cast(AccountManager, account_manager))
14 changes: 7 additions & 7 deletions src/feditest/nodedrivers/wordpress/ubos.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
USERID_NON_EXISTING_ACCOUNT_FIELD,
WordPressAccount,
WordPressNonExistingAccount,
WordPressPlusActivityPubPluginNode
WordPressPlusPluginsNode
)
from feditest.protocols import (
Account,
Expand Down Expand Up @@ -47,7 +47,7 @@ def set_node(self, node: Node) -> None:
self._accounts_not_allocated_to_role.append(admin_account)


class WordPressPlusActivityPubPluginUbosNode(WordPressPlusActivityPubPluginNode):
class WordPressPlusPluginsUbosNode(WordPressPlusPluginsNode):
"""
A WordPress + ActivityPubPlugin Node running on UBOS. This means we know how to interact with it exactly.
"""
Expand All @@ -63,14 +63,14 @@ def provision_non_existing_account_for_role(self, role: str | None = None) -> No

def add_cert_to_trust_store(self, root_cert: str) -> None:
config = cast(UbosNodeConfiguration, self.config)
node_driver = cast(WordPressPlusActivityPubPluginUbosNodeDriver, self.node_driver)
node_driver = cast(WordPressPlusPluginsUbosNodeDriver, self.node_driver)

node_driver.add_cert_to_trust_store_via(root_cert, config.rshcmd)


def remove_cert_from_trust_store(self, root_cert: str) -> None:
config = cast(UbosNodeConfiguration, self.config)
node_driver = cast(WordPressPlusActivityPubPluginUbosNodeDriver, self.node_driver)
node_driver = cast(WordPressPlusPluginsUbosNodeDriver, self.node_driver)

node_driver.remove_cert_from_trust_store_via(root_cert, config.rshcmd)

Expand All @@ -85,7 +85,7 @@ def _provision_oauth_token_for(self, account: WordPressAccount, oauth_client_id:

trace(f'Provisioning OAuth token on {self} for user with name="{ account.userid }".')
config = cast(UbosNodeConfiguration, self.config)
node_driver = cast(WordPressPlusActivityPubPluginUbosNodeDriver, self.node_driver)
node_driver = cast(WordPressPlusPluginsUbosNodeDriver, self.node_driver)

token = os.urandom(16).hex()
php_script = f"""
Expand All @@ -107,7 +107,7 @@ def _provision_oauth_token_for(self, account: WordPressAccount, oauth_client_id:
return token


class WordPressPlusActivityPubPluginUbosNodeDriver(UbosNodeDriver):
class WordPressPlusPluginsUbosNodeDriver(UbosNodeDriver):
"""
Knows how to instantiate Mastodon via UBOS.
"""
Expand Down Expand Up @@ -170,4 +170,4 @@ def create_configuration_account_manager(self, rolename: str, test_plan_node: Te

# Python 3.12 @override
def _instantiate_ubos_node(self, rolename: str, config: UbosNodeConfiguration, account_manager: AccountManager) -> Node:
return WordPressPlusActivityPubPluginUbosNode(rolename, config, account_manager)
return WordPressPlusPluginsUbosNode(rolename, config, account_manager)
2 changes: 1 addition & 1 deletion tests.smoke/wordpress.saas.constellation.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"roles": {
"server": {
"nodedriver": "WordPressPlusActivityPubPluginSaasNodeDriver",
"nodedriver": "WordPressPlusPluginsSaasNodeDriver",
"parameters": {
"hostname" : "testing.feditest.org",
"verify_api_tls_certificate" : false
Expand Down
2 changes: 1 addition & 1 deletion tests.smoke/wordpress.ubos.constellation.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"roles": {
"server": {
"nodedriver": "WordPressPlusActivityPubPluginUbosNodeDriver"
"nodedriver": "WordPressPlusPluginsUbosNodeDriver"
}
},
"name": null
Expand Down
2 changes: 1 addition & 1 deletion tests.smoke/wordpress_mastodon.ubos.constellation.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"roles": {
"leader_node": {
"nodedriver": "WordPressPlusActivityPubPluginUbosNodeDriver"
"nodedriver": "WordPressPlusPluginsUbosNodeDriver"
},
"follower_node": {
"nodedriver": "MastodonUbosNodeDriver"
Expand Down
Loading