Ejemplo n.º 1
0
 def test_level_error(self):
     ftc = FakeTestCase()
     logger = logging.getLogger()
     logassert.setup(ftc, '')
     logger.info("test")
     ftc.assertNotLoggedError("test")
     self.assertEqual(ftc.failed, None)
Ejemplo n.º 2
0
 def test_assert_different_level_ok_warning(self):
     ftc = FakeTestCase()
     logger = logging.getLogger()
     logassert.setup(ftc, '')
     logger.warning("test")
     ftc.assertLoggedWarning("test")
     self.assertEqual(ftc.failed, None)
Ejemplo n.º 3
0
 def test_simple_ok(self):
     ftc = FakeTestCase()
     logger = logging.getLogger()
     logassert.setup(ftc, '')
     logger.debug("test")
     ftc.assertNotLogged("other")
     self.assertEqual(ftc.failed, None)
Ejemplo n.º 4
0
 def test_simple_ok(self):
     ftc = FakeTestCase()
     logger = logging.getLogger()
     logassert.setup(ftc, '')
     logger.debug("test")
     ftc.assertNotLogged("other")
     self.assertEqual(ftc.failed, None)
Ejemplo n.º 5
0
 def test_level_error(self):
     ftc = FakeTestCase()
     logger = logging.getLogger()
     logassert.setup(ftc, '')
     logger.info("test")
     ftc.assertNotLoggedError("test")
     self.assertEqual(ftc.failed, None)
Ejemplo n.º 6
0
 def test_simple_assert_fail(self):
     ftc = FakeTestCase()
     logassert.setup(ftc, '')
     self.logger.debug("test")
     ftc.assertLogged("test2")
     self.assertEqual(ftc.failed, "Tokens ('test2',) not found, all was logged is...\n"
                                  "    DEBUG     'test'")
Ejemplo n.º 7
0
 def test_say_hi_on_first_install(self):
     mgr = PipManager(BIN_PATH, pip_installed=True, options=['--bar=baz'])
     with patch.object(helpers, 'logged_exec'):
         mgr.install('foo')
         self.assertLoggedInfo("Hi! This is fades")
         logassert.setup(self, 'fades.pipmanager')
         mgr.install('bar')
         self.assertNotLoggedInfo("Hi! This is fades")
Ejemplo n.º 8
0
 def test_simple_assert_fail(self):
     ftc = FakeTestCase()
     logassert.setup(ftc, '')
     self.logger.debug("test")
     ftc.assertLogged("test2")
     self.assertEqual(
         ftc.failed, "Tokens ('test2',) not found, all was logged is...\n"
         "    DEBUG     'test'")
Ejemplo n.º 9
0
 def test_simple_assert_fail_with_replaces(self):
     ftc = FakeTestCase()
     logger = logging.getLogger()
     logassert.setup(ftc, '')
     logger.debug("test %d %r", 65, 'foobar')
     ftc.assertLogged("test", "pumba")
     self.assertEqual(ftc.failed, "Tokens ('test', 'pumba') not found, all was logged is...\n"
                                  "    DEBUG     \"test 65 'foobar'\"")
Ejemplo n.º 10
0
 def test_assert_different_level_fail_oneway(self):
     ftc = FakeTestCase()
     logger = logging.getLogger()
     logassert.setup(ftc, '')
     logger.warning("test")
     ftc.assertLoggedDebug("test")
     self.assertEqual(ftc.failed, "Tokens ('test',) not found in DEBUG, all was logged is...\n"
                                  "    WARNING   'test'")
Ejemplo n.º 11
0
 def test_simple_fail(self):
     ftc = FakeTestCase()
     logger = logging.getLogger()
     logassert.setup(ftc, '')
     logger.info("test")
     ftc.assertNotLogged("test")
     self.assertEqual(ftc.failed,
                      "Tokens ('test',) found in the following record:  INFO  'test'")
Ejemplo n.º 12
0
 def test_say_hi_on_first_install(self):
     mgr = PipManager(BIN_PATH, pip_installed=True, options=['--bar=baz'])
     with patch.object(helpers, 'logged_exec'):
         mgr.install('foo')
         self.assertLoggedInfo("Hi! This is fades")
         logassert.setup(self, 'fades.pipmanager')
         mgr.install('bar')
         self.assertNotLoggedInfo("Hi! This is fades")
Ejemplo n.º 13
0
 def test_level_debug_fail(self):
     ftc = FakeTestCase()
     logger = logging.getLogger()
     logassert.setup(ftc, '')
     logger.debug("test")
     ftc.assertNotLoggedDebug("test")
     self.assertEqual(ftc.failed,
                      "Tokens ('test',) found in the following record:  DEBUG  'test'")
Ejemplo n.º 14
0
 def test_simple_assert_ok_extras(self):
     ftc = FakeTestCase()
     logassert.setup(ftc, '')
     formatter = logging.Formatter("%(message)s %(foo)s")
     for h in self.logger.handlers:
         h.setFormatter(formatter)
     self.logger.debug("test", extra={'foo': 'bar'})
     ftc.assertLogged("test bar")
     self.assertEqual(ftc.failed, None)
Ejemplo n.º 15
0
 def setUp(self):
     # Source
     self.db = MemoryTLESource()
     self.db.add_tle(BUGSAT_SATE_ID, BUGSAT1_TLE_LINES, datetime.now())
     # Predictor
     self.predictor = HighAccuracyTLEPredictor(BUGSAT_SATE_ID, self.db)
     self.is_ascending_mock = self._patch(
         'orbit_predictor.accuratepredictor.LocationPredictor.is_ascending')
     self.start = datetime(2017, 3, 6, 7, 51)
     logassert.setup(self, 'orbit_predictor.accuratepredictor')
 def setUp(self):
     # Source
     self.db = MemoryTLESource()
     self.db.add_tle(BUGSAT_SATE_ID, BUGSAT1_TLE_LINES,
                     dt.datetime.utcnow())
     # Predictor
     self.predictor = TLEPredictor(BUGSAT_SATE_ID, self.db)
     self.is_ascending_mock = self._patch(
         'orbit_predictor.predictors.base.LocationPredictor._is_ascending')
     self.start = dt.datetime(2017, 3, 6, 7, 51)
     logassert.setup(self, 'orbit_predictor.predictors.pass_iterators')
Ejemplo n.º 17
0
    def test_salutes_once(self):
        logger = log_set_up(verbose=False, quiet=False)
        logger.info("test foobar")
        self.assertLoggedInfo("Hi! This is fades")
        self.assertLoggedInfo("test foobar")

        # again, check this time it didn't salute, but original log message is ok
        logassert.setup(self, 'fades')
        logger.info("test barbarroja")
        self.assertNotLoggedInfo("Hi! This is fades")
        self.assertLoggedInfo("test barbarroja")
Ejemplo n.º 18
0
    def test_salutes_once(self):
        logger = log_set_up(verbose=False, quiet=False)
        logger.info("test foobar")
        self.assertLoggedInfo("Hi! This is fades")
        self.assertLoggedInfo("test foobar")

        # again, check this time it didn't salute, but original log message is ok
        logassert.setup(self, 'fades')
        logger.info("test barbarroja")
        self.assertNotLoggedInfo("Hi! This is fades")
        self.assertLoggedInfo("test barbarroja")
Ejemplo n.º 19
0
 def test_assert_different_level_ok_exception(self):
     ftc = FakeTestCase()
     logger = logging.getLogger()
     logassert.setup(ftc, '')
     try:
         raise ValueError("test error")
     except:
         logger.exception("test message")
     ftc.assertLoggedError("test error")
     ftc.assertLoggedError("test message")
     ftc.assertLoggedError("ValueError")
     self.assertEqual(ftc.failed, None)
Ejemplo n.º 20
0
    def test_avoid_delayed_messaging(self):
        ftc = FakeTestCase()
        logger = logging.getLogger()
        logassert.setup(ftc, '')

        class Exploding:
            """Explode on delayed str."""
            should_explode = False

            def __str__(self):
                if self.should_explode:
                    raise ValueError("str exploded")
                return "didn't explode"

        # log something using the Exploding class
        exploding = Exploding()
        logger.debug("feeling lucky? %s", exploding)

        # now flag the class to explode and check
        exploding.should_explode = True
        ftc.assertLogged("feeling lucky", "didn't explode")
Ejemplo n.º 21
0
 def setUp(self):
     logassert.setup(self, '')
Ejemplo n.º 22
0
 def setUp(self):
     logassert.setup(self, 'fades')
Ejemplo n.º 23
0
 def setUp(self):
     super().setUp()
     logassert.setup(self, "")
Ejemplo n.º 24
0
 def setUp(self):
     logassert.setup(self, 'fades.helpers')
     self.deps = parsing.parse_manual(["django==1.7.5", "requests"])
     self.deps_higher = parsing.parse_manual(["django==100.1.1"])
     self.deps_same_than_latest = parsing.parse_manual(["django==1.9"])
Ejemplo n.º 25
0
 def test_simple_assert_ok_with_replaces(self):
     ftc = FakeTestCase()
     logassert.setup(ftc, '')
     self.logger.debug("test %d %r", 65, 'foobar')
     ftc.assertLogged("test", "65", "foobar")
     self.assertEqual(ftc.failed, None)
Ejemplo n.º 26
0
 def test_get_handler(self):
     ftc = FakeTestCase()
     h = logassert.setup(ftc, '')
     self.assertIsInstance(h, logging.Handler)
Ejemplo n.º 27
0
 def test_simple_assert_ok(self):
     ftc = FakeTestCase()
     logassert.setup(ftc, '')
     self.logger.debug("test")
     ftc.assertLogged("test")
     self.assertEqual(ftc.failed, None)
Ejemplo n.º 28
0
 def setUp(self):
     logassert.setup(self, 'fades.parsing')
Ejemplo n.º 29
0
 def setUp(self):
     logassert.setup(self, 'fades.helpers')
Ejemplo n.º 30
0
 def setUp(self):
     logassert.setup(self, 'fades.pipmanager')
Ejemplo n.º 31
0
 def setUp(self):
     logassert.setup(self, 'fades.envbuilder')
Ejemplo n.º 32
0
 def setUp(self):
     logassert.setup(self, 'ops.lib')
Ejemplo n.º 33
0
 def setUp(self):
     logassert.setup(self, 'fades.helpers')
     self.deps = parsing.parse_manual(["django==1.7.5", "requests"])
     self.deps_higher = parsing.parse_manual(["django==100.1.1"])
     self.deps_same_than_latest = parsing.parse_manual(["django==1.9"])
Ejemplo n.º 34
0
 def setUp(self):
     logassert.setup(self, 'fades.parsing')
Ejemplo n.º 35
0
 def setUp(self):
     logassert.setup(self, 'fades.helpers')
Ejemplo n.º 36
0
 def setUp(self):
     logassert.setup(self, 'fades.envbuilder')
Ejemplo n.º 37
0
 def setUp(self):
     logassert.setup(self, 'fades.pipmanager')
Ejemplo n.º 38
0
 def setUp(self):
     logassert.setup(self, 'fades')