def test_that_sync_is_called(self, soledad_mock): instance = soledad_mock.return_value instance.server_url = '/foo/bar' soledad_session = SoledadSession(self.provider, 'any-passphrase', self.auth.token, self.auth.uuid) # when soledad_session.sync() # then instance.sync.assert_called_with()
def test_that_sync_not_called_if_not_needed(self, mock): instance = mock.return_value instance.server_url = '/foo/bar' instance.need_sync.return_value = False soledad_session = SoledadSession(self.provider, 'any-passphrase', self.auth.token, self.auth.uuid) # when soledad_session.sync() # then instance.need_sync.assert_called_with('/foo/bar') self.assertFalse(instance.sync.called)
def test_that_sync_is_called(self, soledad_mock): instance = soledad_mock.return_value instance.server_url = '/foo/bar' instance.need_sync.return_value = True soledad_session = SoledadSession(self.provider, 'any-passphrase', self.srp_session) # when soledad_session.sync() # then instance.need_sync.assert_called_with('/foo/bar') instance.sync.assert_called_with()