From efb96ee0c3bef458665872079352f6e8b5eea532 Mon Sep 17 00:00:00 2001 From: Kelsey Hawley Date: Tue, 17 Dec 2013 15:35:23 -0800 Subject: [PATCH] added test for dump-anydbm that uses module subprocess to run script --- tests/test_dump-anydbm.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/test_dump-anydbm.py b/tests/test_dump-anydbm.py index 0497fb8..0e2ddee 100644 --- a/tests/test_dump-anydbm.py +++ b/tests/test_dump-anydbm.py @@ -3,6 +3,7 @@ #from warcprox.bin import dump-anydbm import pytest import os +import subprocess # to access the script from shell # will try as python 3 then default to python 2 modules try: @@ -71,5 +72,16 @@ def test_assert_reading_dumbdbm_correctly(make_dumbdbm_test_db): assert db.has_key('very first key') assert db['very first key'] == 'very first value' +def test_dumpanydbm_identify_gbdm(make_gdbm_test_db): + print "running test_dumpanydbm_identify_gbdm" + output = subprocess.check_output(["dump-anydbm", make_gdbm_test_db]) + output = output.split("/n") + + # split on space, then grab 4th word, which is db type + which = output[0].split(' ')[3] + print which + assert which == "gdbm" or "dbm.gdbm" + +