コード例 #1
0
ファイル: test_app.py プロジェクト: farzadghanei/navdoon
    def test_create_destinations(self):
        app = App(['--config', self.config_filename])
        destinations = app.create_destinations()
        self.assertEqual(1, len(destinations))
        self.assertEqual([Stdout()], destinations)

        app_flush_graphite = App(['--flush-graphite', 'localhost'])
        destinations = app_flush_graphite.create_destinations()
        self.assertEqual(1, len(destinations))
        self.assertEqual([Graphite('localhost', 2003)], destinations)

        app_multi_flush = App(
            ['--config', self.config_filename, '--flush-graphite',
             'example.org:2006,localhost'])
        destinations = app_multi_flush.create_destinations()
        self.assertEqual(3, len(destinations))
        expected = [
            Stdout(), Graphite('example.org', 2006),
            Graphite ('localhost', 2003)
        ]
        self.assertEqual(expected, destinations)
コード例 #2
0
ファイル: test_app.py プロジェクト: farzadghanei/navdoon
    def test_create_destinations(self):
        app = App(['--config', self.config_filename])
        destinations = app.create_destinations()
        self.assertEqual(1, len(destinations))
        self.assertEqual([Stdout()], destinations)

        app_flush_graphite = App(['--flush-graphite', 'localhost'])
        destinations = app_flush_graphite.create_destinations()
        self.assertEqual(1, len(destinations))
        self.assertEqual([Graphite('localhost', 2003)], destinations)

        app_multi_flush = App([
            '--config', self.config_filename, '--flush-graphite',
            'example.org:2006,localhost'
        ])
        destinations = app_multi_flush.create_destinations()
        self.assertEqual(3, len(destinations))
        expected = [
            Stdout(),
            Graphite('example.org', 2006),
            Graphite('localhost', 2003)
        ]
        self.assertEqual(expected, destinations)
コード例 #3
0
ファイル: test_app.py プロジェクト: farzadghanei/navdoon
 def test_create_csv_file_destinations(self):
     try:
         _, temp_file_name = mkstemp()
         other_temp_file_name = temp_file_name + '_2'
         app = App([
             '--flush-file-csv', '{}|{}'.format(temp_file_name,
                                                other_temp_file_name)
         ])
         destinations = app.create_destinations()
         self.assertEqual(2, len(destinations))
         self.assertEqual(
             [CsvFile(temp_file_name),
              CsvFile(other_temp_file_name)], destinations)
     finally:
         if os.path.exists(temp_file_name):
             os.remove(temp_file_name)
         if os.path.exists(other_temp_file_name):
             os.remove(other_temp_file_name)