Refactored test PyPI package logic into its own functions

 * Added tests
 * Added some documentation
 * Cleaned up test CLI script