Exemple #1
0
    def test_it_converts_each_entity_to_json(self, entity2json, dissect):
        # Arrange
        retriever = Retriever(Mock())
        function = Function(id_='func1', name='function1')

        # Act
        retriever.on_entity(function)

        # Assert
        entity2json.convert.assert_called_once_with(function, 'id_')
Exemple #2
0
    def test_it_calls_back_with_each_entity_in_json(self, entity2json, dissect):
        # Arrange
        callback = Mock()
        retriever = Retriever(callback)
        function = Function(id_='func1', name='function1')
        entity2json.convert.return_value = 'fake json'

        # Act
        retriever.on_entity(function)

        # Assert
        callback.assert_called_once_with('fake json')