Ejemplo n.º 1
0
    def test_find_address_is_none(self):
        # arrange

        qp = QueryProcessor(bucket_count=10)
        qp._hash_func = MagicMock(return_value=9)
        q = Query(["find", "test"])

        # act
        mock_write_found = MagicMock()
        qp.write_search_result = mock_write_found
        qp.process_query(query=q)

        # assert
        mock_write_found.assert_called_with(False)
Ejemplo n.º 2
0
    def test_find_is_in_processor(self):
        # arrange

        qp = QueryProcessor(bucket_count=10)
        qp._hash_func = MagicMock(return_value=1)
        qp.elems[1] = ["a", "b", "c", "test", "d"]
        q = Query(["find", "test"])

        # act
        mock_write_found = MagicMock()
        qp.write_search_result = mock_write_found
        qp.process_query(query=q)

        # assert
        mock_write_found.assert_called_with(True)