def test_dbremove_rule(self): with open(TESTFILE) as f1: assert f1.read() != "" uniargs = [u"-E", u"testmmąöî", u"mmąöî"] dgm_cli.dbremove(self.db, self.config, uniargs) assert os.path.exists(TESTFILE) with open(TESTFILE) as f1: assert f1.read() == ""
def test_dbremove_ruleset(self): uniargs_add = [u"testmmąöî", u"mmąöî2", u"fake@mmąöî", u"mmąöî", \ u"mmąöî", u"mmąöî", u"mmąöî", u"mmąöî", u"mmąöî"] dgm_cli.dbadd(self.db, self.config, uniargs_add) uniargs = [u"-E", u"testmmąöî"] dgm_cli.dbremove(self.db, self.config, uniargs) assert os.path.exists(TESTFILE) #it's not a bug, it's a feature... with open(TESTFILE) as f1: assert f1.read() == ""
def test_dbcopy_ruleset_nocreate(self): # Create a second rs uniargs_add = [u"mmąöî666", u"mmąöî", u"fake@mmąöî", u"mmąöî", u"mmąöî", \ u"mmąöî", u"mmąöî", u"mmąöî", u"mmąöî"] dgm_cli.dbadd(self.db, self.config, uniargs_add) # Empty second rs uniargs_rem = [u"-E", u"mmąöî666"] dgm_cli.dbremove(self.db, self.config, uniargs_rem) filepath = os.path.join(BASEDIR, u"mmąöî666.rs") # Test if still here and empty assert os.path.exists(filepath) with open(filepath) as f1: assert f1.read() == "" # Copy from test to second rs uniargs = [u"testmmąöî", u"mmąöî666"] dgm_cli.dbcopy(self.db, self.config, uniargs) with open(filepath) as f1: with open(TESTFILE) as f2: assert f1.read() == f2.read()