File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -129,6 +129,42 @@ def test_rsyncer_status(
129129 )
130130
131131
132+ @pytest .mark .parametrize ("notify" , (True , False ))
133+ def test_rsyncer_notify (
134+ mocker : MockerFixture ,
135+ tmp_path : Path ,
136+ mock_server_url : MagicMock ,
137+ notify : bool ,
138+ ):
139+ # Patch the superclass that RSyncer stems from
140+ mock_notify = mocker .patch ("murfey.client.rsync.Observer.notify" )
141+ mock_notify .return_value = None
142+
143+ # Initialise the RSyncer
144+ rsyncer = RSyncer (
145+ basepath_local = tmp_path / "local" ,
146+ basepath_remote = tmp_path / "remote" ,
147+ rsync_module = mock .ANY ,
148+ server_url = mock_server_url ,
149+ notify = notify ,
150+ )
151+ # Check that the 'notify' attribute is set correctly
152+ assert rsyncer ._notify == notify
153+
154+ # Run 'notify' and check that the expected calls were made
155+ rsyncer .notify ("arg1" , "arg2" , kwarg1 = "kwarg1" , kwarg2 = "kwarg2" )
156+ if notify :
157+ mock_notify .assert_called_once_with (
158+ "arg1" ,
159+ "arg2" ,
160+ secondary = False ,
161+ kwarg1 = "kwarg1" ,
162+ kwarg2 = "kwarg2" ,
163+ )
164+ else :
165+ mock_notify .assert_not_called ()
166+
167+
132168@pytest .mark .parametrize ("rsyncer_status" , ("default" , "is_alive" , "stopping" ))
133169def test_rsyncer_start (
134170 tmp_path : Path ,
You can’t perform that action at this time.
0 commit comments