Comment 15 for bug 1393536

Revision history for this message
Robert Lyon (robertl-9) wrote :

Basic testing of connection manager:

Steps to test the connection manager where sending an email to a user in site (A) will update values of user in site (B) - not the best test but it does work:

1) Have two mahara sites on different urls both with the patches checked out, one will be the 'from' site (A) and the other the 'to' site (B)

2) Have a user with the same ID in both of the mahara sites. Make sure both of the users belong to an institution (doesn't have to be the same one) that has the 'webservice' auth enabled and that both users have 'webservices' as their authentication method.

3) On site (B) make the user an institution admin so they have permissions to update a user (them-self)

4) On site (B) as admin go to Webservices and make sure that the webservices is on and that REST option is on, and that 'Switch managed client collections' is on.

5) Then go to the 'Manage service access tokens' and generate token for the user and make sure they have the service 'User provisioning'. Remember/Copy the token value.

6) On site (A) as admin go to Webservices and make sure that the webservices is on and that REST option is on, and that 'Switch managed client collections' is on.

7) You will need to use the test plugin 'notification/log' (ask robertl for it). Install the plugin file in the htdocs/notification directory and then install the plugin via Administration -> Extensions

8) Go to Institutions and click on the 'plug' icon for the institution the user is in. You should see the connection manager page with the dropdown containing one option 'PluginNotificationLog'

9) Click 'Add' and fill in:

Name: some random name
Connection enabled: tick the box
Web service type: REST
Authentication type: Token
Web Service URL: The url of site(B) + path to rest service, eg:
   https://mahara-testing/webservice/rest/server.php
Token: the token we got from step 5.
JSON encoded: tick the box

And save the form.

10) On site (A) log in as the user you want to test and go to Settings -> Notifications and change the 'Messages from other users' to 'Log' and save

11) On site (A) log in as admin and send a message to the user.

12) Now on site (A) the user should receive a message from admin but their Profile occupation and introduction should not change. But over on site (B) the user should have their Profile occupation and introduction change to subject and message of the sent email.

This proves that the connection manager is working and that an event on site (A) made a change to site(B).

If this fails check the error logs on site (A) to see what problems occurred. The should be a log line thus -
Mahara message from: [from email] to: [to email] subject: [subject of the message sent]
and below that there should be two arrays with headings
notification/log - connection:
notification/log - response:

The response one will tell you what is wrong with the connection to site (B)