gustafn
committed
on 29 Apr 16
- use tcl operations instead of external programs
openacs-4/.../test/tclwebtest-procs.tcl (+1 -1)
4 4     @author Mounir Lallali.
5 5     @creation-date 20 September 2005
6 6
7 7 }
8 8
9 9 namespace eval evaluation::twt {}
10 10
11 11 ad_proc evaluation::twt::create_file {file_name}  {
12 12    
13 13     # Create a temporal file
14 14     set file_name "/tmp/$file_name"
15 15     exec touch $file_name
16 16     exec ls / >> $file_name
17 17     exec chmod 777 $file_name
18 18     return $file_name
19 19 }
20 20
21 21 ad_proc evaluation::twt::delete_file {file_name}  {
22 22
23 23     # Delete a file name
24       exec rm -rf  $file_name
  24     file delete -force -- $file_name
25 25 }
26 26
27 27 ad_proc evaluation::twt::get_notification_ids { pretty_name } {
28 28    
29 29     # Get the notification ids : type_id, object_id and user_id
30 30     set link [lindex [tclwebtest::link find ~u "(.+)request-new\?(.*)pretty(.+)name=$pretty_name\(.+)"] 7]
31 31
32 32     set type_id [::tclwebtest::regsplit ".+type.+id=(.+)&.+object.+" $link]
33 33     set object_id [::tclwebtest::regsplit ".+type.+id=.+object.+id=(.+)&.+" $link]
34 34     set user_id [::tclwebtest::regsplit ".+user.+id=(.+)" $link]
35 35
36 36     return [list $type_id $object_id $user_id]
37 37 }
38 38
39 39 ad_proc evaluation::twt::get_task_grade_id { task_name } {
40 40    
41 41     db_1row task_id "select task_id from evaluation_tasks where task_name=:task_name"
42 42     db_1row grade_item_id "select grade_item_id from evaluation_tasks where task_name=:task_name"
43 43     db_1row grade_id "select grade_id from evaluation_grades where grade_item_id=:grade_item_id"
44 44