summaryrefslogtreecommitdiff
path: root/evolution/del_assigned_task.py
blob: 148da302da89c6a78374746a686bfb6678a4de41 (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
83
84
85
#
#  Linux Desktop Testing Project http://www.gnomebangalore.org/ldtp
#
#  Author:
#     Venkateswaran S <wenkat.s@gmail.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.
#
# This script will delete a particular task.


from ldtp import *
from ldtputils import *
#from evoutils.tasks import *
import string, sys, os, commands, time, filecmp

def read_data ():
	log('read user data','teststart')
	try:
		data_object = LdtpDataFileParser (datafilename)
		summary = data_object.gettagvalue ('summary')
		log('User data read successfull','info')
 		log('read user data','testend')
		return summary
		
	except:
		log('Unable to read the user data or data file missing','error')
 		log('read user data','testend')
		raise LdtpExecutionError(0)

	log('read user data','testend')
# The takes the tsak summary as input and deletes that task. 
# Note: This doesnt chk whether the selected task is assigned or not.

try:
	log('Delete a task','teststart')
	Wrong_index = 'The index you entered exceeded the no of available tasks'
	waittillguiexist('frmEvolution-Tasks')
	summary = read_data()

	remap('evolution','frmEvolution-Tasks')
	no_rows_b4deleting = getrowcount ('frmEvolution-Tasks', 'tblTaskTable') 

	if selectrowpartialmatch ('frmEvolution-Tasks', 'tblTaskTable', summary[0]) == 1:

		click('frmEvolution-Tasks', 'btnDelete')
		waittillguiexist('dlgEvolutionQuery')
		undoremap('evolution','frmEvolution-Tasks')
		remap('evolution','dlgEvolutionQuery')
		time.sleep(3)
		click('dlgEvolutionQuery','btnDelete')
		undoremap('evolution','dlgEvolutionQuery')
		remap('evolution','frmEvolution-Tasks')
		no_rows_afterdeleting = getrowcount ('frmEvolution-Tasks', 'tblTaskTable') 
		if no_rows_afterdeleting == no_rows_b4deleting -1:
			print 'The task has been deleted'
			log('the task has been deleted','info')	
		else:
			print 'Deletion of task verify failed'
			log('Deletion of task verify failed','error')
	else:
		print 'Unable to select a task with the given summary'
		log('unable to select the task','error')

except:
	log('Unable to delete a Task','error')
	log('Delete a task','testend')
	raise LdtpExecutionError(0)

log('Delete a task','testend')