OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # -*- coding: utf-8 -*- | 2 # -*- coding: utf-8 -*- |
3 """Tests for the Skype main.db history database plugin.""" | 3 """Tests for the Skype main.db history database plugin.""" |
4 | 4 |
5 from __future__ import unicode_literals | 5 from __future__ import unicode_literals |
6 | 6 |
7 import unittest | 7 import unittest |
8 | 8 |
9 from plaso.formatters import skype as _ # pylint: disable=unused-import | 9 from plaso.formatters import skype as _ # pylint: disable=unused-import |
10 from plaso.lib import timelib | |
11 from plaso.parsers.sqlite_plugins import skype | 10 from plaso.parsers.sqlite_plugins import skype |
12 | 11 |
13 from tests import test_lib as shared_test_lib | 12 from tests import test_lib as shared_test_lib |
14 from tests.parsers.sqlite_plugins import test_lib | 13 from tests.parsers.sqlite_plugins import test_lib |
15 | 14 |
16 | 15 |
17 class SkypePluginTest(test_lib.SQLitePluginTestCase): | 16 class SkypePluginTest(test_lib.SQLitePluginTestCase): |
18 """Tests for the Skype main.db history database plugin.""" | 17 """Tests for the Skype main.db history database plugin.""" |
19 | 18 |
20 @shared_test_lib.skipUnlessHasTestFile(['skype_main.db']) | 19 @shared_test_lib.skipUnlessHasTestFile(['skype_main.db']) |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 if event.data_type == 'skype:event:sms': | 53 if event.data_type == 'skype:event:sms': |
55 number_of_sms += 1 | 54 number_of_sms += 1 |
56 if event.data_type == 'skype:event:chat': | 55 if event.data_type == 'skype:event:chat': |
57 number_of_chats += 1 | 56 number_of_chats += 1 |
58 | 57 |
59 self.assertEqual(number_of_files, 4) | 58 self.assertEqual(number_of_files, 4) |
60 self.assertEqual(number_of_sms, 1) | 59 self.assertEqual(number_of_sms, 1) |
61 self.assertEqual(number_of_chats, 15) | 60 self.assertEqual(number_of_chats, 15) |
62 self.assertEqual(number_of_calls, 3) | 61 self.assertEqual(number_of_calls, 3) |
63 | 62 |
64 # TODO: Split this up into separate functions for testing each type of | |
65 # event, e.g. testSMS, etc. | |
66 sms_event = events[16] | |
67 call_event = events[22] | |
68 event_file = events[18] | |
69 chat_event = events[1] | |
70 chat_room_event = events[14] | |
71 | |
72 # Test cache processing and format strings. | 63 # Test cache processing and format strings. |
73 event = events[17] | 64 event = events[17] |
74 | 65 |
75 expected_message = ( | 66 expected_message = ( |
76 'Source: gen.beringer <Gen Beringer> Destination: ' | 67 'Source: gen.beringer <Gen Beringer> Destination: ' |
77 'european.bbq.competitor <European BBQ> File: secret-project.pdf ' | 68 'european.bbq.competitor <European BBQ> File: secret-project.pdf ' |
78 '[SENDSOLICITUDE]') | 69 '[SENDSOLICITUDE]') |
79 expected_short_message = '{0:s}...'.format(expected_message[:77]) | 70 expected_short_message = '{0:s}...'.format(expected_message[:77]) |
80 | 71 |
81 self._TestGetMessageStrings(event, expected_message, expected_short_message) | 72 self._TestGetMessageStrings(event, expected_message, expected_short_message) |
82 | 73 |
83 expected_timestamp = timelib.Timestamp.CopyFromString( | 74 sms_event = events[16] |
84 '2013-07-01 22:14:22') | 75 |
85 self.assertEqual(sms_event.timestamp, expected_timestamp) | 76 self.CheckTimestamp(sms_event.timestamp, '2013-07-01 22:14:22.000000') |
86 | 77 |
87 text_sms = ( | 78 text_sms = ( |
88 'If you want I can copy ' | 79 'If you want I can copy ' |
89 'some documents for you, ' | 80 'some documents for you, ' |
90 'if you can pay it... ;)') | 81 'if you can pay it... ;)') |
91 self.assertEqual(sms_event.text, text_sms) | 82 self.assertEqual(sms_event.text, text_sms) |
92 | 83 |
93 self.assertEqual(sms_event.number, '+34123456789') | 84 self.assertEqual(sms_event.number, '+34123456789') |
94 | 85 |
95 expected_timestamp = timelib.Timestamp.CopyFromString( | 86 event_file = events[18] |
96 '2013-10-24 21:49:35') | 87 |
97 self.assertEqual(event_file.timestamp, expected_timestamp) | 88 self.CheckTimestamp(event_file.timestamp, '2013-10-24 21:49:35.000000') |
98 | 89 |
99 action_type = 'GETSOLICITUDE' | 90 action_type = 'GETSOLICITUDE' |
100 self.assertEqual(event_file.action_type, action_type) | 91 self.assertEqual(event_file.action_type, action_type) |
101 source = 'gen.beringer <Gen Beringer>' | 92 source = 'gen.beringer <Gen Beringer>' |
102 self.assertEqual(event_file.source, source) | 93 self.assertEqual(event_file.source, source) |
103 destination = 'european.bbq.competitor <European BBQ>' | 94 destination = 'european.bbq.competitor <European BBQ>' |
104 self.assertEqual(event_file.destination, destination) | 95 self.assertEqual(event_file.destination, destination) |
105 transferred_filename = 'secret-project.pdf' | 96 transferred_filename = 'secret-project.pdf' |
106 self.assertEqual(event_file.transferred_filename, transferred_filename) | 97 self.assertEqual(event_file.transferred_filename, transferred_filename) |
107 filepath = '/Users/gberinger/Desktop/secret-project.pdf' | 98 filepath = '/Users/gberinger/Desktop/secret-project.pdf' |
108 self.assertEqual(event_file.transferred_filepath, filepath) | 99 self.assertEqual(event_file.transferred_filepath, filepath) |
109 self.assertEqual(event_file.transferred_filesize, 69986) | 100 self.assertEqual(event_file.transferred_filesize, 69986) |
110 | 101 |
111 expected_timestamp = timelib.Timestamp.CopyFromString( | 102 chat_event = events[1] |
112 '2013-07-30 21:27:11') | 103 |
113 self.assertEqual(chat_event.timestamp, expected_timestamp) | 104 self.CheckTimestamp(chat_event.timestamp, '2013-07-30 21:27:11.000000') |
114 | 105 |
115 title = 'European Competitor | need to know if you got it..' | 106 title = 'European Competitor | need to know if you got it..' |
116 self.assertEqual(chat_event.title, title) | 107 self.assertEqual(chat_event.title, title) |
117 expected_message = 'need to know if you got it this time.' | 108 expected_message = 'need to know if you got it this time.' |
118 self.assertEqual(chat_event.text, expected_message) | 109 self.assertEqual(chat_event.text, expected_message) |
119 from_account = 'Gen Beringer <gen.beringer>' | 110 from_account = 'Gen Beringer <gen.beringer>' |
120 self.assertEqual(chat_event.from_account, from_account) | 111 self.assertEqual(chat_event.from_account, from_account) |
121 self.assertEqual(chat_event.to_account, 'european.bbq.competitor') | 112 self.assertEqual(chat_event.to_account, 'european.bbq.competitor') |
122 | 113 |
123 expected_timestamp = timelib.Timestamp.CopyFromString( | 114 chat_room_event = events[14] |
124 '2013-10-27 15:29:19') | 115 |
125 self.assertEqual(chat_room_event.timestamp, expected_timestamp) | 116 self.CheckTimestamp(chat_room_event.timestamp, '2013-10-27 15:29:19.000000') |
126 | 117 |
127 title = 'European Competitor, Echo123' | 118 title = 'European Competitor, Echo123' |
128 self.assertEqual(chat_room_event.title, title) | 119 self.assertEqual(chat_room_event.title, title) |
129 expected_message = 'He is our new employee' | 120 expected_message = 'He is our new employee' |
130 self.assertEqual(chat_room_event.text, expected_message) | 121 self.assertEqual(chat_room_event.text, expected_message) |
131 from_account = 'European Competitor <european.bbq.competitor>' | 122 from_account = 'European Competitor <european.bbq.competitor>' |
132 self.assertEqual(chat_room_event.from_account, from_account) | 123 self.assertEqual(chat_room_event.from_account, from_account) |
133 to_account = 'gen.beringer, echo123' | 124 to_account = 'gen.beringer, echo123' |
134 self.assertEqual(chat_room_event.to_account, to_account) | 125 self.assertEqual(chat_room_event.to_account, to_account) |
135 | 126 |
136 expected_timestamp = timelib.Timestamp.CopyFromString( | 127 call_event = events[22] |
137 '2013-07-01 22:12:17') | 128 |
138 self.assertEqual(call_event.timestamp, expected_timestamp) | 129 self.CheckTimestamp(call_event.timestamp, '2013-07-01 22:12:17.000000') |
139 | 130 |
140 self.assertEqual(call_event.dst_call, 'european.bbq.competitor') | 131 self.assertEqual(call_event.dst_call, 'european.bbq.competitor') |
141 self.assertEqual(call_event.src_call, 'gen.beringer') | 132 self.assertEqual(call_event.src_call, 'gen.beringer') |
142 self.assertEqual(call_event.user_start_call, False) | 133 self.assertEqual(call_event.user_start_call, False) |
143 self.assertEqual(call_event.video_conference, False) | 134 self.assertEqual(call_event.video_conference, False) |
144 | 135 |
145 | 136 |
146 if __name__ == '__main__': | 137 if __name__ == '__main__': |
147 unittest.main() | 138 unittest.main() |
OLD | NEW |