tests: refactor: rename test_resource_path() -> resource_path() and use it more.
Straighten up the exceptions when getting a packages header. (RhBug:1122900)

In the process, moves around the dnf.rpm methods to load the header.