From 6decc39bc7314cf0596ea682bf17677b68888a5a Mon Sep 17 00:00:00 2001 From: Aaron Bentley Date: Thu, 24 Mar 2005 06:44:47 +0000 Subject: [PATCH] started work on test case for "new" --- becommands/new.py | 11 ++++++++++- libbe/tests.py | 5 +++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/becommands/new.py b/becommands/new.py index afa6494..01acf96 100644 --- a/becommands/new.py +++ b/becommands/new.py @@ -1,6 +1,15 @@ """Create a new bug""" -from libbe import bugdir, cmdutil, names, utility +from libbe import bugdir, cmdutil, names, utility, tests def execute(args): + """ + >>> import os + >>> dir = tests.bug_arch_dir() + >>> os.chdir(dir.dir) + >>> names.uuid = lambda: "a" + >>> execute (("this is a test",)) + Created bug with ID a + >>> tests.clean_up() + """ if len(args) != 1: raise cmdutil.UserError("Please supply a summary message") dir = cmdutil.bug_tree() diff --git a/libbe/tests.py b/libbe/tests.py index ecd6ed5..b6d3083 100644 --- a/libbe/tests.py +++ b/libbe/tests.py @@ -2,6 +2,7 @@ import tempfile import shutil import os import os.path +from libbe import bugdir, arch cleanable = [] def clean_up(): global cleanable @@ -22,3 +23,7 @@ def arch_dir(): dir = Dir() os.mkdir(os.path.join(dir.name, "{arch}")) return dir + +def bug_arch_dir(): + dir = arch_dir() + return bugdir.create_bug_dir(dir.name, arch) -- 2.26.2