def test_document_belongs_to(self): """Check if ``belongs_to()`` on ``Document`` is working properly. """ user = User() project = Project() document_file = DocumentFile() document = Document() project.document_files = [document_file] document_file.documents = [document] user.projects = [project] user.save() project.save() document.save() document_file.save() assert document.belongs_to(user)