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

Improve mock #723

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from
Draft

Improve mock #723

wants to merge 1 commit into from

Conversation

CarlSchwan
Copy link
Contributor

No description provided.

@CarlSchwan CarlSchwan marked this pull request as draft March 3, 2024 16:21
kdesysadmin pushed a commit to KDE/neochat that referenced this pull request Mar 3, 2024
@@ -760,6 +760,9 @@ public Q_SLOTS:
static Connection* makeMockConnection(const QString& mxId,
bool enableEncryption = E2EE_Enabled);

static Connection* makeMockConnection(Connection *connection, const QString& mxId,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this API looks weird, why is it a static function that's passed an object?

Looking at the neochat MR for this, it seems that we could easily use the existing makeMockConnection function

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the issue with the existing function is that it return a Connection * and not a NeoChatConnection *

Copy link
Member

@KitsuneRal KitsuneRal Mar 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AccountRegistry looks like a good place for it? Then you could derive from it and override a virtual function. Or simply making makeMockConnection() a template would also work I guess (would need pulling completeSetup() from Connection::Private to Connection but that's a smaller evil)?

@@ -947,6 +950,9 @@ public Q_SLOTS:
Room* provideRoom(const QString& roomId,
Omittable<JoinState> joinState = none);

//! Add room to the connection
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also mention that this is only for tests and not useful in normal operation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants