Skip to content
This repository has been archived by the owner on Dec 28, 2020. It is now read-only.

Commit

Permalink
CLI tests only for Python2 right now
Browse files Browse the repository at this point in the history
  • Loading branch information
palewire committed Jul 21, 2014
1 parent a009095 commit 378a7a5
Showing 1 changed file with 35 additions and 34 deletions.
69 changes: 35 additions & 34 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,40 +197,41 @@ def test_open_archive_directory(self):
# CLI tests
#

class CLITest(BaseTest):

def setUp(self):
super(CLITest, self).setUp()
self.this_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.append(self.this_dir)
self.simple_url = "http://www.example.com"

def test_get(self):
path = os.path.join(self.this_dir, "bin/storytracker-get")
cmd = '%s %s' % (path, self.simple_url)
process = Command(cmd)
code, out, err = process.run(timeout=3)
python = storytracker.get(self.simple_url).encode("utf-8")
self.assertEqual(type(out), type(python))
self.assertEqual(out, python)

def test_get_no_verify(self):
path = os.path.join(self.this_dir, "bin/storytracker-get")
cmd = '%s %s --do-not-verify' % (path, self.simple_url)
process = Command(cmd)
code, out, err = process.run(timeout=3)
python = storytracker.get(self.simple_url).encode("utf-8")
self.assertEqual(type(out), type(python))
self.assertEqual(out, python)

def test_archive(self):
path = os.path.join(self.this_dir, "bin/storytracker-archive")
cmd = '%s %s --do-not-compress' % (path, self.simple_url)
process = Command(cmd)
code, out, err = process.run(timeout=3)
python = storytracker.archive(self.simple_url).html.encode("utf-8")
self.assertEqual(type(out), type(python))
self.assertEqual(out, python)
if six.PY2:
class CLITest(BaseTest):

def setUp(self):
super(CLITest, self).setUp()
self.this_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.append(self.this_dir)
self.simple_url = "http://www.example.com"

def test_get(self):
path = os.path.join(self.this_dir, "bin/storytracker-get")
cmd = '%s %s' % (path, self.simple_url)
process = Command(cmd)
code, out, err = process.run(timeout=3)
python = storytracker.get(self.simple_url).encode("utf-8")
self.assertEqual(type(out), type(python))
self.assertEqual(out, python)

def test_get_no_verify(self):
path = os.path.join(self.this_dir, "bin/storytracker-get")
cmd = '%s %s --do-not-verify' % (path, self.simple_url)
process = Command(cmd)
code, out, err = process.run(timeout=3)
python = storytracker.get(self.simple_url).encode("utf-8")
self.assertEqual(type(out), type(python))
self.assertEqual(out, python)

def test_archive(self):
path = os.path.join(self.this_dir, "bin/storytracker-archive")
cmd = '%s %s --do-not-compress' % (path, self.simple_url)
process = Command(cmd)
code, out, err = process.run(timeout=3)
python = storytracker.archive(self.simple_url).html.encode("utf-8")
self.assertEqual(type(out), type(python))
self.assertEqual(out, python)


if __name__ == '__main__':
Expand Down

0 comments on commit 378a7a5

Please sign in to comment.