Adding a single basic test asserting that the help text is properly displayed.

This commit is contained in:
Adam Coddington 2014-10-05 20:46:07 -07:00
parent 434535f6a4
commit 9c6e59c26d
3 changed files with 16 additions and 2 deletions

View file

@ -6,6 +6,7 @@ command line scripts, and related.
"""
import argparse
import pickle
import sys
import pyicloud
@ -30,7 +31,10 @@ def create_pickled_data(idevice, filename):
pickle_file.close()
def main():
def main(args=None):
if args is None:
args = sys.argv
""" Main Function """
parser = argparse.ArgumentParser(
description="Find My iPhone CommandLine Tool")
@ -146,7 +150,7 @@ def main():
help="Save device data to a file in the current directory.",
)
command_line = parser.parse_args()
command_line = parser.parse_args(args)
if not command_line.username or not command_line.password:
parser.error('No username or password supplied')

0
tests/__init__.py Normal file
View file

10
tests/test_sanity.py Normal file
View file

@ -0,0 +1,10 @@
from unittest import TestCase
from pyicloud.cmdline import main
class SanityTestCase(TestCase):
def test_basic_sanity(self):
with self.assertRaises(SystemExit):
main(['--help'])