Пример #1
0
class TestRule(TestCase):
    @classmethod
    def setUp(self):
        self.r = Rule()
        self.name = 'rulenametest'
        self.description = 'this is message text'
        self.command = ['cat foo | grep']
        self.depfile = 'output.d'

        self.example_rule = { 'name' : self.name,
                              'description': self.description,
                              'command': self.command,
                              'depfile': self.depfile }
             
    def test_rule_return(self):
        self.r.name(self.name)
        self.r.description(self.description)
        self.r.command(self.command)
        rule = self.r.rule()

        self.assertEqual(type(rule), type(self.example_rule))

    def test_rule_has_keys(self):
        self.r.name(self.name)
        self.r.description(self.description)
        self.r.command(self.command)
        self.r.depfile(self.depfile)
        rule = self.r.rule()

        self.assertEqual(rule.keys(), self.example_rule.keys())
Пример #2
0
class TestRule(TestCase):
    @classmethod
    def setUp(self):
        self.r = Rule()
        self.name = 'rulenametest'
        self.description = 'this is message text'
        self.command = ['cat foo | grep']
        self.depfile = 'output.d'

        self.example_rule = {
            'name': self.name,
            'description': self.description,
            'command': self.command,
            'depfile': self.depfile
        }

    def test_rule_return(self):
        self.r.name(self.name)
        self.r.description(self.description)
        self.r.command(self.command)
        rule = self.r.rule()

        self.assertEqual(type(rule), type(self.example_rule))

    def test_rule_has_keys(self):
        self.r.name(self.name)
        self.r.description(self.description)
        self.r.command(self.command)
        self.r.depfile(self.depfile)
        rule = self.r.rule()

        self.assertEqual(rule.keys(), self.example_rule.keys())
Пример #3
0
class TestRuleRestat(TestCase):
    @classmethod
    def setUp(self):
        self.r = Rule()

    def test_restat_return_value(self):
        self.assertTrue(self.r.restat())

    def test_restat_exists(self):
        self.r.restat()
        self.assertTrue(self.r.restat())

    def test_rule_without_name(self):
        with self.assertRaises(InvalidRule):
            self.r.rule()
Пример #4
0
class TestRuleRestat(TestCase):
    @classmethod
    def setUp(self):
        self.r = Rule()

    def test_restat_return_value(self):
        self.assertTrue(self.r.restat())

    def test_restat_exists(self):
        self.r.restat()
        self.assertTrue(self.r.restat())

    def test_rule_without_name(self):
        with self.assertRaises(InvalidRule):
            self.r.rule()