Exemplo n.º 1
0
class TestLog(TestCase):
    """Test Suite for Log class."""
    def setUp(self):
        self.log = Log()

    def test_levels_property(self):
        """test that levels property depends on desired_level."""
        self.assertEqual(len(self.log.levels), 4)
        self.log.desired_level = "warning"
        self.assertEqual(len(self.log.levels), 2)
        self.assertIn("warning", self.log.levels)

    def test_emit_is_false(self):
        """test that emit returns False if message level not in levels."""
        self.log.desired_level = "warning"
        self.assertFalse(self.log.emit("taco", "info"))

    def test_emit_is_true(self):
        """test that emit returns True if message level in levels."""
        self.assertTrue(self.log.emit("taco", "info"))
Exemplo n.º 2
0
class TestLog(TestCase):
    """Test Suite for Log class."""
    def setUp(self):
        self.log = Log()

    def test_levels_property(self):
        """test that levels property depends on desired_level."""
        self.assertEqual(len(self.log.levels), 4)
        self.log.desired_level = 'warning'
        self.assertEqual(len(self.log.levels), 2)
        self.assertIn('warning', self.log.levels)

    def test_emit_is_false(self):
        """test that emit returns False if message level not in levels."""
        self.log.desired_level = 'warning'
        self.assertFalse(self.log.emit('taco', 'info'))

    def test_emit_is_true(self):
        """test that emit returns True if message level in levels."""
        self.assertTrue(self.log.emit('taco', 'info'))
Exemplo n.º 3
0
    def __init__(self, vpc_name, config=None, region_name=None, profile_name=None, log=None):
        """
        vpc_name:
         The human readable Name tag of this VPC.

        config:
         The dict returned by botoform.config.ConfigLoader's load method.
        """
        self.vpc_name = vpc_name
        self.config = config if config is not None else {}
        self.log = log if log is not None else Log()
        self.boto = BotoConnections(region_name, profile_name)
        self.reflect = False
Exemplo n.º 4
0
    def __init__(self,
                 vpc_name=None,
                 region_name=None,
                 profile_name=None,
                 log=None):
        self.boto = BotoConnections(region_name, profile_name)

        # capture a list of this classes attributes before reflecting.
        self.self_attrs = dir(self)

        self.log = log if log is not None else Log()

        if vpc_name is not None:
            self.vpc_name = vpc_name
            self.connect(vpc_name)
Exemplo n.º 5
0
 def setUp(self):
     self.log = Log()
Exemplo n.º 6
0
 def setUp(self):
     self.log = Log()