Browse Source

Improve coverage

tags/nilmdb-2.0.0
Jim Paris 4 years ago
parent
commit
7874e1ebfa
1 changed files with 15 additions and 0 deletions
  1. +15
    -0
      tests/test_cmdline.py

+ 15
- 0
tests/test_cmdline.py View File

@@ -591,6 +591,13 @@ class TestCmdline(object):
exitcode = 2, require_error = False) exitcode = 2, require_error = False)
self.contain("no data") self.contain("no data")


# unannotated empty extract is just empty, with an exit code of 2
self.fail("extract /newton/prep " +
"--start '23 Mar 2022 10:00:30' " +
"--end '23 Mar 2022 10:00:31'",
exitcode = 2, require_error = False)
self.match("")

# but are ok if we're just counting results # but are ok if we're just counting results
self.ok("extract --count /newton/prep " + self.ok("extract --count /newton/prep " +
"--start '23 Mar 2012 20:00:30' " + "--start '23 Mar 2012 20:00:30' " +
@@ -601,6 +608,14 @@ class TestCmdline(object):
"--end '23 Mar 2012 20:00:30.000002'") "--end '23 Mar 2012 20:00:30.000002'")
self.match("0\n") self.match("0\n")


# Extract needs --start and --end
self.fail("extract -a /newton/prep")
self.contain("arguments are required")
self.fail("extract -a /newton/prep --start 2000-01-01")
self.contain("arguments are required")
self.fail("extract -a /newton/prep --end 2000-01-01")
self.contain("arguments are required")

# Check various dumps against stored copies of how they should appear # Check various dumps against stored copies of how they should appear
def test(file, start, end, extra=""): def test(file, start, end, extra=""):
self.ok("extract " + extra + " /newton/prep " + self.ok("extract " + extra + " /newton/prep " +


Loading…
Cancel
Save