1
from mago.test_suite.evolution import EvolutionTestSuite
2
from mago.application.evolution import Evolution, AccountInfo
3
from mago.check import ScreenshotCompare, FAIL
4
from mago.application.deskex import NotifyOSD
6
from ConfigParser import ConfigParser
7
import ldtp, ooldtp, ldtputils
8
from time import sleep, time
9
from shutil import copytree, move
10
from os.path import expanduser
12
class EvolutionUseApp(Evolution):
13
def open(self, profile_template='', credentials='',
15
self.me_account = AccountInfo(me_account, credentials)
18
self.generate_profile(profile_template, self.me_account.template_args)
20
Evolution.open(self, False, credentials)
22
class EvolutionNotifyTest(EvolutionTestSuite):
23
APPLICATION_FACTORY = EvolutionUseApp
27
def testNotifyMyself(self, subject, body, oracle, password=''):
30
email = self.application.me_account.template_args['emailaddress']
31
password = self.application.me_account.template_args['password']
33
self.application.compose_new_message(email, subject, body)
34
self.application.send_email(subject)
36
# Force sending the email
40
self.application.send_and_receive(password, True, True)
42
# Wait for notification (TODO)
43
elapsed, screeny = notify.grab_image_and_wait("1 New Message", 40)
45
checker = ScreenshotCompare(oracle, screeny)
48
passed = checker.perform_test()
54
raise AssertionError('screenshots differ', screeny)
57
# Get the list of messages and check if it was correctly received
58
messages_list = self.application.get_list_messages()
61
for msg in messages_list:
62
if str(msg['subject']) == str(subject):
67
raise AssertionError("The message was not correctly received.",
68
ldtputils.imagecapture())