You are correct. You will have to rely on existing metadata to complete your tests. You can still create documents and put them existing library's.
One thing I did in my tests for a similar implementation is to ensure that after every SQL I check to see if the list was empty. If it was I set a variable to a useful error message.
Then I system.assertEquals('false',varName);
That way if the list was not empty it passed and if it was empty I could at least present a useful error when the user looked as the reason it failed without having to review code or use the developer console.
Expected: false, Actual: The record type 'Public Library' does not exist. Please create it to continue the test
is all the end user needs to resolved the issue. Sometime it is all the developer needs when the time lapse between writing the code and troubleshooting is lengthy.