Cosmetic fixes in tests
CLI code refactoring, improved segmented uploads