Esempio n. 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())
Esempio n. 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())
Esempio n. 3
0
class TestRuleCommand(TestCase):
    @classmethod
    def setUp(self):
        self.r = Rule()
        self.command = ['cat foo | grep']

    def test_command_helper(self):
        self.r.command(self.command)
        self.assertEqual(self.command , self.r._rule['command'])

    def test_default_command_state(self):
        self.assertEqual(self.r.command(), None)

    def test_cmd_command_alias(self):
        self.assertEqual(self.r.cmd, self.r.command)

    def test_command_return_value(self):
        self.assertTrue(self.r.command(self.command))

    def test_command_string(self):
        cmd = 'a string'
        self.assertEqual(self.r.command(cmd), cmd)
Esempio n. 4
0
class TestRuleCommand(TestCase):
    @classmethod
    def setUp(self):
        self.r = Rule()
        self.command = ['cat foo | grep']

    def test_command_helper(self):
        self.r.command(self.command)
        self.assertEqual(self.command, self.r._rule['command'])

    def test_default_command_state(self):
        self.assertEqual(self.r.command(), None)

    def test_cmd_command_alias(self):
        self.assertEqual(self.r.cmd, self.r.command)

    def test_command_return_value(self):
        self.assertTrue(self.r.command(self.command))

    def test_command_string(self):
        cmd = 'a string'
        self.assertEqual(self.r.command(cmd), cmd)