1 = Testing = 2 3 Before attempting to integrate imip-agent with other system components, 4 it can be useful to check whether the different programs function as 5 expected by themselves. Should errors or faults occur, these would need 6 to be remedied first before attempting to get the software working with 7 the [[../MailIntegration|mail]] and [[../WebServerIntegration|Web]] 8 system components. 9 10 <<TableOfContents(2,2)>> 11 12 == How the Software Works == 13 14 To see how the software operates, you can run one of the agent programs 15 provided in the distribution. For example: 16 17 {{{ 18 ./imip_resource.py -S xxx/store -P xxx/static -p xxx/prefs -d \ 19 < tests/templates/event-request.txt 20 }}} 21 22 This uses one of the test files, sending it to the agent program for 23 resource entities, producing output resembling the following: 24 25 {{{ 26 Outgoing parts for paul.boddie@example.com... 27 From nobody Wed Oct 28 00:24:41 2015 28 MIME-Version: 1.0 29 Content-Transfer-Encoding: base64 30 Content-Type: text/calendar; charset="utf-8"; method="REPLY" 31 From: calendar@example.com 32 To: paul.boddie@example.com 33 Subject: Calendar system message 34 35 QkVHSU46VkNBTEVOREFSDQpNRVRIT0Q6UkVQTFkNClZFUlNJT046Mi4wDQpCRUdJTjpWRlJFRUJV 36 U1kNCk9SR0FOSVpFUjptYWlsdG86cGF1bC5ib2RkaWVAZXhhbXBsZS5jb20NCkFUVEVOREVFO1NF 37 TlQtQlk9Im1haWx0bzpjYWxlbmRhckBleGFtcGxlLmNvbSI6bWFpbHRvOnJlc291cmNlLXJvb20t 38 Y29uZnJvb20NCiBAZXhhbXBsZS5jb20NClVJRDpmYjFAZXhhbXBsZS5jb20NCkVORDpWRlJFRUJV 39 U1kNCkVORDpWQ0FMRU5EQVINCg== 40 }}} 41 42 The rather opaque encoding can be inspected using the `tools/showmail.py` 43 program, and thus the result of the script can be seen by piping the output 44 through that program as follows: 45 46 {{{ 47 ./imip_resource.py -S xxx/store/ -P xxx/static/ -p xxx/prefs/ -d \ 48 < tests/templates/event-request.txt \ 49 | tools/showmail.py 50 }}} 51 52 The result should resemble the following: 53 54 {{{ 55 Outgoing parts for paul.boddie@example.com... 56 MIME-Version: 1.0 57 Content-Type: text/calendar; charset="utf-8"; method="REPLY" 58 From: calendar@example.com 59 To: paul.boddie@example.com 60 Subject: Calendar system message 61 62 BEGIN:VCALENDAR 63 METHOD:REPLY 64 VERSION:2.0 65 BEGIN:VEVENT 66 DTSTAMP:20151027T232738Z 67 UID:event1@example.com 68 ATTENDEE;PARTSTAT=ACCEPTED;SENT-BY="mailto:calendar@example.com":mailto:reso 69 urce-room-confroom@example.com 70 SUMMARY:Meeting at 4pm 71 ORGANIZER:mailto:paul.boddie@example.com 72 DTSTART;TZID=Europe/Oslo:20141126T160000 73 DTEND;TZID=Europe/Oslo:20141126T170000 74 END:VEVENT 75 END:VCALENDAR 76 }}} 77 78 What has happened here is the presentation of a request to the resource 79 program in the form of an e-mail message containing an iCalendar event 80 employing a scheduling method. The program interprets the request, 81 consults its own records, makes a decision about scheduling the event, 82 and indicates the kind of response it would like to send back to the 83 requester. 84 85 == The Test Suite == 86 87 A script called `test_all.sh` is provided that runs a test suite (found 88 in the `tests` directory within the source code distribution), initialising 89 new and separate data store instances for each test, running programs that 90 are presented with message content, and testing for the desired effects of 91 running those programs with such content. 92 93 Individual tests may also be run directly from the topmost level of the 94 source code distribution. For example: 95 96 {{{ 97 tests/test_resource_invitation.sh 98 }}} 99 100 Should everything be functioning correctly, `Success` should be reported 101 repeatedly as opposed to `Failed`. If the latter occurs, the output of the 102 tests should be inspected: a number of files whose names end with `.tmp` 103 will have been saved in the current directory, and these will contain the 104 output from various commands from the last test script invocation; the 105 `err.tmp` will contain tracebacks indicating serious error conditions, 106 should any have occurred.