Exemple #1
0
    def test_iter(self):
        config = self.get_standard_config()
        crash_source = PGQueryNewCrashSource(config, name='fred')
        crash_source.close()

        # the call to be tested & what should have happened
        for i, (exp, actual) in enumerate(
                izip_longest(self.expected_sequence, crash_source())):
            assert exp == actual

        assert i == 4
    def test_iter(self):
        config = self.get_standard_config()
        crash_source = PGQueryNewCrashSource(config, name='fred')
        crash_source.close()

        # the call to be tested & what should have happened
        for i, (exp, actual) in enumerate(
                izip_longest(self.expected_sequence, crash_source())):
            eq_(exp, actual)

        eq_(
            i, 4, 'there should have been exactly 5 iterations, instead: %d' %
            (i + 1))
Exemple #3
0
    def test_init_and_close(self):
        config = self.get_standard_config()

        # the calls to be tested
        crash_source = PGQueryNewCrashSource(config, name='fred')
        crash_source.close()

        # this is what should have happened
        assert crash_source.config is config
        assert crash_source.name == 'fred'
        config.database_class.assert_called_once_with(config)
        config.transaction_executor_class.assert_called_once_with(
            config, crash_source.database, quit_check_callback=None)
        crash_source.database.close.assert_called_once_with()
    def test_init_and_close(self):
        config = self.get_standard_config()

        # the calls to be tested
        crash_source = PGQueryNewCrashSource(config, name='fred')
        crash_source.close()

        # this is what should have happened
        ok_(crash_source.config is config)
        eq_(crash_source.name, 'fred')
        config.database_class.assert_called_once_with(config)
        config.transaction_executor_class.assert_called_once_with(
            config,
            crash_source.database,
            quit_check_callback=None
        )
        crash_source.database.close.assert_called_once_with()
    def test_iter(self):
        config = self.get_standard_config()
        crash_source = PGQueryNewCrashSource(config, name='fred')
        crash_source.close()

        # the call to be tested & what should have happened
        for i, (exp, actual) in enumerate(izip_longest(
            self.expected_sequence,
            crash_source())
        ):
            eq_(exp, actual)

        eq_(
            i,
            4,
            'there should have been exactly 5 iterations, instead: %d'
            % (i + 1)
        )