0

Used packages:

Paramiko and Unittest

Details

A somewhat special question that is probably quite easy to answer. I am currently testing the functionality on a cmd level with a unit test. In this test case, a cmd command is listed on a switch on the one hand "q = self.s.query ('clock-source local')". This sets the clock source function to local or NTP. The test works.

Another command (show daylight) generates an overview which shows me the time and further information. I would like to see this in the logged streaming and in the log file.

    def test_enable_clock_source_local(self):
    logger_true.info('test_enable_clock_source_local')
    if self.s.loggedin:
        logger.info('self.s.loggedin')
        q = self.s.query('time')
        logger.info('time')
        self.assertIsNotNone(q, 'missing answer')
        self.assertEqual('\r\n', q, 'unexpected result')
        logger.info('missing answer')
        logger.info('unexpected result')

        # switch to prompt account

        q = self.s.query('clock-source local')
        logger.info('clock-source local')
        q = self.s.query('exit')
        self.assertIsNotNone(q, 'missing answer')
        self.assertEqual('\r\n', q, 'unexpected result')
        logger.info('missing answer')
        logger.info('unexpected result')

Clock Source          : NTP Server
Local Time            : 2011-01-05 02:53:24  (YYYY-MM-DD HH:MM:SS)
Time Zone Offset      : 60 (min)
Daylight Savings      : Enabled
Time Set Offset       : 60 (min)
Daylight Savings Type : Recurring
From                  : Day:Sun Week:Last  Month:Mar Time:02:00
To                    : Day:Sun Week:Last  Month:Oct Time:03:00

Question:

Which command can I use accordingly to let me show this in the log or in the straming handler. And will this be formatted accordingly?

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
Mornon
  • 59
  • 5
  • 22
  • You forgot to ask a question... and 'show daylight' nowhere occurs in your problematic code - no wonder it's not logged. – planetmaker Oct 02 '18 at 09:53
  • Thank´s i added a question ;) – Mornon Oct 02 '18 at 09:57
  • what do you mean by this question? I still do not really understand `show daylight` et al, where does it come from – Antti Haapala -- Слава Україні Oct 02 '18 at 10:10
  • 2
    That code is only incidental to your question, which appears to be about logging. So you need to create a [mcve] that focuses on the logging side of things. – PM 2Ring Oct 02 '18 at 10:25
  • Hi Antti, "Show Daylight" is a comand on a hardware switch that i used to show me the NTP or local Status of the Time. What I want to know is how the status of NTP/locale(clock source) can be displayed in a log. – Mornon Oct 02 '18 at 10:31

0 Answers0