def test_add_still_works(self, entity_class):
        # Arrange
        observable_repo = ObservableEntityRepo(Mock())
        entity = real(entity_class)

        # Act
        observable_repo.add(entity)

        # Assert
        assert_equal(observable_repo.get_by_id(entity.id_), entity)
    def test_it_notifies_when_one_entity_is_added(self, entity_class):
        # Arrange
        observer = Mock()
        repo = ObservableEntityRepo(observer)
        entity = real(entity_class)

        # Act
        repo.add(entity)

        # Assert
        observer.on_entity.assert_called_once_with(entity)
    def test_it_does_not_notify_if_an_entity_is_added_again(self):
        # Arrange
        observer = Mock()
        repo = ObservableEntityRepo(observer)
        module = real('Module')

        # Act
        repo.add(module)
        repo.add(module)

        # Assert
        observer.on_entity.assert_called_once_with(module)