summaryrefslogtreecommitdiff
path: root/evolution/copy_mails.py
blob: aeda1ff14ab5f8a84f971edde35b39ae15067baa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#
#  Linux Desktop Testing Project http://www.gnomebangalore.org/ldtp
#
#  Author:
#     Khasim Shaheed <sshaik@novell.com>
#
#  Copyright 2004 Novell, Inc.
#
#  This test script is free software; you can redistribute it and/or
#  modify it under the terms of the GNU Library General Public
#  License as published by the Free Software Foundation; either
#  version 2 of the License, or (at your option) any later version.
#
#  This library is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#  Library General Public License for more details.
#
#  You should have received a copy of the GNU Library General Public
#  License along with this library; if not, write to the
#  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
#  Boston, MA 02111-1307, USA.
#

#Copy And Verify Copy of Mails
import time

#Copy mails
def copy (source, destination, start, end):
	try:
		for i in range(start, end+1):
			selectrowindex ('Evolution-Mail', 'treetblMails', i)
			click ('Evolution-Mail', 'btnCopy')
			selectrow ('dlgSelectFolder', 'treetblMails', destination)
			click ('dlgSelectFolder', 'btnCopy')
		log ('CopyMails', 'pass')
	except:
		log ('CopyMails', 'fail')

#Verifying copy of mails
def verify_copy (source, destination, no_mails, prev_scount, prev_dcount):
	try:
		click ('Evolution-Mail', 'tbtnMail')
		time.sleep (2)
		selectrow ('Evolution-Mail', 'treeTabFolder', destination)
		new_dcount = getrowcount ('Evolution-Mail', 'treetblMails')
                selectrow ('Evolution-Mail', 'treeTabFolder', source)
		new_scount = getrowcount ('Evolution-Mail', 'treetblMails')
		if (new_scount == prev_scount and new_dcount == (prev_dcount+no_mails)):
			log ('Verify-Copy-Mails', 'pass')
	        else:
			log ('Verify-Copy-Mails', 'fail')
        except:
		log ('Verify-Copy-Mails', 'fail')

#Getting the data from a file		
file = open('copy_mails.dat', 'r')
argmts = file.readlines()
source = argmts[1].strip( )
destination = argmts[2].strip( )
start = int (argmts[3].strip( ))
end = int (argmts[4].strip( ))

#Calling the functions and getting the initial
#message count of source and destination folders
log('CopyAndVerifyCopyofMails', 'teststart')
log('CopyMails' ,'teststart')
click ('Evolution-Mail', 'tbtnMail')
time.sleep (2)
selectrow ('Evolution-Mail', 'treeTabFolder', destination)
time.sleep (1)
prev_dcount = getrowcount ('Evolution-Mail', 'treetblMails')
selectrow ('Evolution-Mail', 'treeTabFolder', source)
time.sleep (1)
prev_scount = getrowcount ('Evolution-Mail', 'treetblMails')
copy (source, destination, start, end)
log('CopyMails' ,'testend')
log('VerificationofCopyMails', 'teststart')
no_mails = end-start+1
verify_copy (source, destination, no_mails, prev_scount, prev_dcount)
log('VerificationofCopyMails' ,'testend')
log('CopyMailsandVerificationofCopyMails','testend')