add add_document to api.py and add test_add_document in tests.py