Skip to content

Commit

Permalink
Adding a single basic test asserting that the help text is properly d…
Browse files Browse the repository at this point in the history
…isplayed.
  • Loading branch information
Adam Coddington committed Oct 6, 2014
1 parent 434535f commit 9c6e59c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pyicloud/cmdline.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"""
import argparse
import pickle
import sys

import pyicloud

Expand All @@ -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")
Expand Down Expand Up @@ -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')

Expand Down
Empty file added tests/__init__.py
Empty file.
10 changes: 10 additions & 0 deletions tests/test_sanity.py
Original file line number Diff line number Diff line change
@@ -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'])

0 comments on commit 9c6e59c

Please sign in to comment.