def test_check_final_multiple_rules_fails(self): '''A cat with multiple rules should fail if any are final.''' cat = Cat(Mock(spec=Templater)) cat.rules = [ Rule(self.srcfile1, self.tmpdir / 'outdne', final=True), Rule(self.srcfile2, self.tmpdir)] self.assertFalse(cat.check())
def test_check_outpath_isdir_fails(self): '''A cat where the outpath is currently a dir should fail checks.''' cat = Cat(Mock(spec=Templater)) cat.rules = [ Rule(self.srcfile1, self.tmpdir), Rule(self.srcfile2, self.tmpdir)] self.assertFalse(cat.check())
def test_check_outpaths_dont_match_fails(self): '''A cat where the outpaths don't match should fail checks.''' cat = Cat(Mock(spec=Templater)) cat.rules = [ Rule(self.srcfile1, self.tmpdir / 'outdne'), Rule(self.srcfile2, self.tmpdir / 'differentdne')] self.assertFalse(cat.check())
def test_check_srcpath_not_file_fails(self): '''A cat where one src file isn't readable should fail checks.''' cat = Cat(Mock(spec=Templater)) cat.rules = [ Rule(self.tmpdir / 'srcdne', self.tmpdir / 'outdne'), Rule(self.srcfile2, self.tmpdir / 'outdne')] self.assertFalse(cat.check())
def test_check_srcpaths_exist_outpath_dne_succeeds(self): '''A cat with readable srcs and nonexistent out should pass checks.''' cat = Cat(Mock(spec=Templater)) cat.rules = [ Rule(self.srcfile1, self.tmpdir / 'dne'), Rule(self.srcfile2, self.tmpdir / 'dne')] self.assertTrue(cat.check())
def test_check_final_single_rule_succeeds(self): '''A cat with one final rule should pass checks.''' cat = Cat(Mock(spec=Templater)) cat.rules = [ Rule(self.srcfile1, self.tmpdir / 'outdne', final=True)] self.assertTrue(cat.check())