Skip to content

Commit

Permalink
fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MiaAltieri committed Nov 28, 2023
1 parent d1e6e03 commit 87b9afd
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/unit/test_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@
OperationFailure,
PyMongoError,
)
from tenacity import RetryError

from charm import USER_CREATING_MAX_ATTEMPTS, MongoDBCharm, NotReadyError
from charm import MongoDBCharm, NotReadyError

from .helpers import patch_network_get

Expand Down Expand Up @@ -597,12 +596,14 @@ def test_reconfigure_add_member_failure(self, connection, defer):
connection.return_value.__enter__.return_value.add_replset_member.assert_called()
defer.assert_called()

@patch("charm.MongoDBCharm._initialise_users")
@patch("ops.framework.EventBase.defer")
@patch("charm.MongoDBProvider.oversee_users")
@patch("charm.MongoDBConnection")
def test_start_init_operator_user_after_second_call(
self, connection, oversee_users, defer, _initialise_users
self,
connection,
oversee_users,
defer,
):
"""Tests that the creation of the admin user is only performed once.
Expand All @@ -620,7 +621,6 @@ def test_start_init_operator_user_after_second_call(
connection.return_value.__enter__.return_value.is_ready = True

oversee_users.side_effect = PyMongoError()
_initialise_users.side_effect = RetryError(last_attempt=USER_CREATING_MAX_ATTEMPTS)

self.harness.charm.on.start.emit()

Expand Down

0 comments on commit 87b9afd

Please sign in to comment.