Example #1
0
 def test_choose_timestamp_parser_profile_not_found(self):
     session = Mock(spec=Session)
     session.get_scoped_config.side_effect = ProfileNotFound(profile='foo')
     factory = session.get_component.return_value
     timestampformat.add_timestamp_parser(session)
     factory.set_parser_defaults.assert_called_with(
         timestamp_parser=timestampformat.iso_format)
Example #2
0
 def test_choose_invalid_timestamp_formatter(self):
     session = Mock(spec=Session)
     session.get_scoped_config.return_value = {
         'cli_timestamp_format': 'foobar'
     }
     session.get_component.return_value
     with self.assertRaises(ConfigurationError):
         timestampformat.add_timestamp_parser(session)
Example #3
0
 def test_choose_iso_timestamp_formatter(self):
     session = Mock(spec=Session)
     session.get_scoped_config.return_value = {
         'cli_timestamp_format': 'iso8601'
     }
     factory = session.get_component.return_value
     timestampformat.add_timestamp_parser(session)
     factory.set_parser_defaults.assert_called_with(
         timestamp_parser=timestampformat.iso_format)
Example #4
0
 def test_scalar_parsers_set(self):
     session = Mock()
     session.get_scoped_config.return_value = {
         'cli_timestamp_format': 'wire'
     }
     timestampformat.add_timestamp_parser(session)
     session.get_component.assert_called_with('response_parser_factory')
     factory = session.get_component.return_value
     expected = [call(timestamp_parser=timestampformat.identity)]
     self.assertEqual(factory.set_parser_defaults.mock_calls, expected)