def test_destroy(self, mocker): """Test that destroy/destroyed calls are forwarded to the factory.""" split_storage = mocker.Mock(spec=SplitStorage) segment_storage = mocker.Mock(spec=SegmentStorage) impression_storage = mocker.Mock(spec=ImpressionStorage) event_storage = mocker.Mock(spec=EventStorage) def _get_storage_mock(name): return { 'splits': split_storage, 'segments': segment_storage, 'impressions': impression_storage, 'events': event_storage, }[name] factory = mocker.Mock(spec=SplitFactory) destroyed_mock = mocker.PropertyMock() type(factory).destroyed = destroyed_mock impmanager = mocker.Mock(spec=ImpressionManager) recorder = StandardRecorder(impmanager, event_storage, impression_storage) client = Client(factory, recorder, True) client.destroy() assert factory.destroy.mock_calls == [mocker.call()] assert client.destroyed is not None assert destroyed_mock.mock_calls == [mocker.call()]
def test_destroy(self, mocker): """Test that destroy/destroyed calls are forwarded to the factory.""" split_storage = mocker.Mock(spec=SplitStorage) segment_storage = mocker.Mock(spec=SegmentStorage) impression_storage = mocker.Mock(spec=ImpressionStorage) event_storage = mocker.Mock(spec=EventStorage) telemetry_storage = mocker.Mock(spec=TelemetryStorage) def _get_storage_mock(name): return { 'splits': split_storage, 'segments': segment_storage, 'impressions': impression_storage, 'events': event_storage, 'telemetry': telemetry_storage }[name] factory = mocker.Mock(spec=SplitFactory) destroyed_mock = mocker.PropertyMock() type(factory).destroyed = destroyed_mock client = Client(factory) client.destroy() assert factory.destroy.mock_calls == [mocker.call()] assert client.destroyed is not None assert destroyed_mock.mock_calls == [mocker.call()]