Пример #1
0
    def test_should_call_do_update_for_specified_provider(
            self, mock_get_provider_class, mock_do_update, app):
        # Given
        provider_test = create_provider(local_class="TestLocalProvider")
        repository.save(provider_test)
        mock_get_provider_class.return_value = TestLocalProvider

        # When
        synchronize_data_for_provider(provider_test.__class__.__name__, None)

        # Then
        mock_get_provider_class.assert_called_once()
        mock_do_update.assert_called_once_with(fake(TestLocalProvider), None)
Пример #2
0
    def test_should_start_synchronization_with_linked_provider(
            self, mock_do_update, mock_get_provider_class, app):
        # Given
        limit = 10
        offerer = create_offerer()
        venue = create_venue(offerer)
        provider = create_provider(local_class="TestLocalProvider")
        venue_provider = create_venue_provider(venue, provider)
        repository.save(venue_provider)
        mock_get_provider_class.return_value = TestLocalProvider

        # When
        synchronize_venue_provider(venue_provider, limit)

        # Then
        mock_do_update.assert_called_once_with(fake(TestLocalProvider), limit)
Пример #3
0
    def test_should_synchronize_venue_provider_with_defined_limit(
            self, mock_get_provider_class, mock_do_update, app):
        # Given
        provider_test = create_provider(local_class="TestLocalProvider")
        offerer = create_offerer()
        venue = create_venue(offerer)
        venue_provider = create_venue_provider(venue, provider_test)
        repository.save(venue_provider)
        mock_get_provider_class.return_value = TestLocalProvider

        # When
        synchronize_venue_providers_for_provider(provider_test.id, 10)

        # Then
        mock_get_provider_class.assert_called_once()
        mock_do_update.assert_called_once_with(fake(TestLocalProvider), 10)
    def test_should_entirely_synchronize_venue_provider(
            self, mock_get_provider_class, mock_do_update, app):
        # Given
        provider_test = AllocineProviderFactory()
        offerer = create_offerer()
        venue = create_venue(offerer)
        venue_provider = create_venue_provider(venue, provider_test)
        repository.save(venue_provider)
        mock_get_provider_class.return_value = TestLocalProvider

        # When
        synchronize_venue_providers_for_provider(provider_test.id, None)

        # Then
        mock_get_provider_class.assert_called_once()
        mock_do_update.assert_called_once_with(fake(TestLocalProvider), None)