-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add parsing of messages from services (like ChanServ or Nickserv)
- Loading branch information
Showing
3 changed files
with
23 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,6 +79,25 @@ def test_status_empty(self): | |
self.assertEqual(m.type, "status") | ||
self.assertEqual(m.message, "") | ||
|
||
def test_service(self): | ||
lines = [("01:53 -ChanServ([email protected])- Informations pour le canal #linux:", "service", "Informations pour le canal #linux:", 'ChanServ([email protected])', '01:53'), | ||
("01:53:09 -ChanServ([email protected])- Informations pour le canal #linux:", "service", "Informations pour le canal #linux:", 'ChanServ([email protected])', '01:53:09')] | ||
for line, expected_type, expected_message, expected_nick, expected_time in lines: | ||
m = self._get_FUT(line) | ||
self.assertEqual(m.type, expected_type) | ||
self.assertEqual(m.message, expected_message) | ||
self.assertEqual(m.user, expected_nick) | ||
self.assertEqual(m.time, expected_time) | ||
self.assertEqual(str(m), line) | ||
|
||
def test_service_empty(self): | ||
lines = ["12:11 -ChanServ([email protected])-", | ||
"12:11:10 -ChanServ([email protected])-"] | ||
for line in lines: | ||
m = self._get_FUT(line) | ||
self.assertEqual(m.type, "service") | ||
self.assertEqual(m.message, "") | ||
|
||
def test_unrecognized(self): | ||
m = self._get_FUT("Ceci n'est pas une ligne de log") | ||
self.assertEqual(m.type, "unrecognized") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters