Exemplo n.º 1
0
 def test_cannot_ignore_error(self):
     test_journal = []
     Logger.add_ignored_code('foo')
     with self.assertRaises(FooError):
         Logger.error('foo', 'This foo is bad I have to care')
     test_journal.append(
         LogEntry(ERROR, 'bar', 'foo', 'This foo is bad I have to care'))
     self.assertListEqual(Logger.journal, test_journal)
Exemplo n.º 2
0
    def test_error(self):
        test_journal = []

        with self.assertRaises(FooError) as cm:
            Logger.error('foo', 'This foo is bad')
        self.assertEqual(cm.exception.message, 'This foo is bad')
        test_journal.append(LogEntry(ERROR, 'bar', 'foo', 'This foo is bad'))
        self.assertListEqual(Logger.journal, test_journal)
Exemplo n.º 3
0
 def test_cannot_ignore_error(self):
     test_journal = []
     Logger.add_ignored_code('foo')
     with self.assertRaises(FooError):
         Logger.error('foo', 'This foo is bad I have to care')
     test_journal.append(LogEntry(ERROR, 'bar', 'foo',
                                  'This foo is bad I have to care'))
     self.assertListEqual(Logger.journal, test_journal)
Exemplo n.º 4
0
    def test_error(self):
        test_journal = []

        with self.assertRaises(FooError) as cm:
            Logger.error('foo', 'This foo is bad')
        self.assertEqual(cm.exception.message, 'This foo is bad')
        test_journal.append(LogEntry(ERROR, 'bar', 'foo', 'This foo is bad'))
        self.assertListEqual(Logger.journal, test_journal)
Exemplo n.º 5
0
 def test_unknown_codes(self):
     with self.assertRaises(AssertionError):
         Logger.warn('does-not-exist', 'Should not exist')
     with self.assertRaises(AssertionError):
         Logger.error('does-not-exist', 'Should not exist')
Exemplo n.º 6
0
 def test_ignore_domain(self):
     Logger.add_ignored_domain('bar')
     Logger.warn('baz', 'This baz is bad but I do not care')
     self.assertListEqual(Logger.journal, [])
     with self.assertRaises(FooError):
         Logger.error('foo', 'This foo is bad I need to care')
Exemplo n.º 7
0
 def test_unknown_codes(self):
     with self.assertRaises(AssertionError):
         Logger.warn('does-not-exist', 'Should not exist')
     with self.assertRaises(AssertionError):
         Logger.error('does-not-exist', 'Should not exist')
Exemplo n.º 8
0
 def test_ignore_domain(self):
     Logger.add_ignored_domain('bar')
     Logger.warn('baz', 'This baz is bad but I do not care')
     self.assertListEqual(Logger.journal, [])
     with self.assertRaises(FooError):
         Logger.error('foo', 'This foo is bad I need to care')