[tests] adapt events tests to recent changes
[leap_pycommon.git] / src / leap / common / events / catalog.py
1 # -*- coding: utf-8 -*-
2 # catalog.py
3 # Copyright (C) 2015 LEAP
4 #
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful",
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18
19 """
20 Events catalog.
21 """
22
23
24 EVENTS = [
25     "CLIENT_SESSION_ID",
26     "CLIENT_UID",
27     "RAISE_WINDOW",
28     "UPDATER_DONE_UPDATING",
29     "UPDATER_NEW_UPDATES",
30
31     "KEYMANAGER_DONE_UPLOADING_KEYS",  # (address)
32     "KEYMANAGER_FINISHED_KEY_GENERATION",  # (address)
33     "KEYMANAGER_KEY_FOUND",  # (address)
34     "KEYMANAGER_KEY_NOT_FOUND",  # (address)
35     "KEYMANAGER_LOOKING_FOR_KEY",  # (address)
36     "KEYMANAGER_STARTED_KEY_GENERATION",  # (address)
37
38     "SOLEDAD_CREATING_KEYS",  # {uuid, userid}
39     "SOLEDAD_DONE_CREATING_KEYS",  # {uuid, userid}
40     "SOLEDAD_DONE_DATA_SYNC",  # {uuid, userid}
41     "SOLEDAD_DONE_DOWNLOADING_KEYS",  # {uuid, userid}
42     "SOLEDAD_DONE_UPLOADING_KEYS",  # {uuid, userid}
43     "SOLEDAD_DOWNLOADING_KEYS",  # {uuid, userid}
44     "SOLEDAD_INVALID_AUTH_TOKEN",  # {uuid, userid}
45     "SOLEDAD_SYNC_RECEIVE_STATUS",  # {uuid, userid}
46     "SOLEDAD_SYNC_SEND_STATUS",  # {uuid, userid}
47     "SOLEDAD_UPLOADING_KEYS",  # {uuid, userid}
48     "SOLEDAD_NEW_DATA_TO_SYNC",
49
50     "MAIL_FETCHED_INCOMING",  # (userid)
51     "MAIL_MSG_DECRYPTED",  # (userid)
52     "MAIL_MSG_DELETED_INCOMING",  # (userid)
53     "MAIL_MSG_PROCESSING",  # (userid)
54     "MAIL_MSG_SAVED_LOCALLY",  # (userid)
55     "MAIL_UNREAD_MESSAGES",  # (userid)
56
57     "IMAP_SERVICE_STARTED",
58     "IMAP_SERVICE_FAILED_TO_START",
59     "IMAP_UNHANDLED_ERROR",
60     "IMAP_CLIENT_LOGIN",  # (username)
61
62     "SMTP_SERVICE_STARTED",
63     "SMTP_SERVICE_FAILED_TO_START",
64     "SMTP_START_ENCRYPT_AND_SIGN",  # (from_addr)
65     "SMTP_END_ENCRYPT_AND_SIGN",  # (from_addr)
66     "SMTP_START_SIGN",  # (from_addr)
67     "SMTP_END_SIGN",  # (from_addr)
68     "SMTP_SEND_MESSAGE_START",  # (from_addr)
69     "SMTP_SEND_MESSAGE_SUCCESS",  # (from_addr)
70     "SMTP_RECIPIENT_ACCEPTED_ENCRYPTED",  # (userid, dest)
71     "SMTP_RECIPIENT_ACCEPTED_UNENCRYPTED",  # (userid, dest)
72     "SMTP_CONNECTION_LOST",  # (userid, dest)
73     "SMTP_RECIPIENT_REJECTED",  # (userid, dest)
74     "SMTP_SEND_MESSAGE_ERROR",  # (userid, dest)
75 ]
76
77
78 class Event(object):
79
80     def __init__(self, label):
81         self.label = label
82
83     def __repr__(self):
84         return '<Event: %s>' % self.label
85
86     def __str__(self):
87         return self.label
88
89
90 # create local variables based on the event list above
91 lcl = locals()
92 for event in EVENTS:
93     lcl[event] = Event(event)