コード例 #1
0
    def test_analyze_entries(self):
        entry = self._entry_for_analyze_entries(recorded=True, completed=True)
        entry_only_recorded = self._entry_for_analyze_entries(recorded=True)
        entry_only_completed = self._entry_for_analyze_entries(completed=True)

        entries = {e['entry_id']: e for e in
                   (entry, entry_only_recorded, entry_only_completed)}
        entries_stats = analyze_journal.analyze_entries(entries)

        expected_time = (entry[journal.LOG_COMPLETED] -
                         entry[journal.LOG_RECORDED])
        expected_entry = analyze_journal.EntryStats(
            entry_id=entry['entry_id'], time=expected_time, op=entry['op'],
            obj_type=entry['obj_type'], obj_id=entry['obj_id'])
        self.assertIn(expected_entry, entries_stats)
コード例 #2
0
    def test_analyze_entries(self):
        entry = self._entry_for_analyze_entries(recorded=True, completed=True)
        entry_only_recorded = self._entry_for_analyze_entries(recorded=True)
        entry_only_completed = self._entry_for_analyze_entries(completed=True)

        entries = {
            e['entry_id']: e
            for e in (entry, entry_only_recorded, entry_only_completed)
        }
        entries_stats = analyze_journal.analyze_entries(entries)

        expected_time = (entry[journal.LOG_COMPLETED] -
                         entry[journal.LOG_RECORDED])
        expected_entry = analyze_journal.EntryStats(entry_id=entry['entry_id'],
                                                    time=expected_time,
                                                    op=entry['op'],
                                                    obj_type=entry['obj_type'],
                                                    obj_id=entry['obj_id'])
        self.assertIn(expected_entry, entries_stats)
コード例 #3
0
 def test_analyze_entries_no_recorded_time(self):
     entry = self._entry_for_analyze_entries(completed=True)
     entries = {entry['entry_id']: entry}
     self.assertEqual([], analyze_journal.analyze_entries(entries))
コード例 #4
0
 def test_analyze_entries_no_records(self):
     self.assertEqual([], analyze_journal.analyze_entries({}))
コード例 #5
0
 def test_analyze_entries_no_recorded_time(self):
     entry = self._entry_for_analyze_entries(completed=True)
     entries = {entry['entry_id']: entry}
     self.assertEqual([], analyze_journal.analyze_entries(entries))
コード例 #6
0
 def test_analyze_entries_no_records(self):
     self.assertEqual([], analyze_journal.analyze_entries({}))