Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@core @core_admin
2
Feature: Manage external services tokens
3
  In order to manage external service usage
4
  As an admin
5
  I need to be able to create, filter and delete tokens
6
 
7
  Background:
8
    Given the following "users" exist:
9
      | username  | password  | firstname     | lastname    |
10
      | user1     | user1     | Firstname1    | Lastname1   |
11
      | user2     | user2     | Firstname2    | Lastname2   |
12
      | user3     | user3     | Firstname3    | Lastname3   |
13
      | user4     | user4     | Firstname4    | Lastname4   |
14
    And I change window size to "small"
15
 
16
  @javascript
17
  Scenario: Add a token to user identified by name and then delete that token
18
    Given I log in as "admin"
19
    And I am on site homepage
20
    And I navigate to "Server > Web services > Manage tokens" in site administration
21
    And I press "Create token"
22
    And I set the field "Name" to "Webservice1"
23
    And I set the field "User" to "Firstname1 Lastname1"
24
    And I set the field "Service" to "Moodle mobile web service"
25
    And I set the field "IP restriction" to "127.0.0.1"
26
    When I press "Save changes"
27
    Then the following should exist in the "generaltable" table:
28
      | Name        | First name           | Service                   | IP restriction | Last access |
29
      | Webservice1 | Firstname1 Lastname1 | Moodle mobile web service | 127.0.0.1      | Never       |
30
 
31
    # Verify the message and the "Copy to clipboard" button.
32
    And I should see "Copy the token now. It won't be shown again once you leave this page."
33
    And "Copy to clipboard" "button" should exist
34
 
35
    # New token can only read once.
36
    And I reload the page
37
    And I should not see "Copy the token now. It won't be shown again once you leave this page."
38
    And "Copy to clipboard" "button" should not exist
39
 
40
    # Delete token.
41
    And I click on "Delete" "link" in the "Webservice1" "table_row"
42
    And I should see "Do you really want to delete this web service token for Firstname1 Lastname1 on the service Moodle mobile web service?"
43
    And I press "Delete"
44
    And "Webservice1" "table_row" should not exist
45
 
46
  @javascript @skip_chrome_zerosize
47
  Scenario: Tokens can be filtered by name (case-insensitive), by user and by service
48
    Given the following "core_webservice > Service" exists:
49
      | name      | Site information              |
50
      | shortname | siteinfo                      |
51
      | enabled   | 1                             |
52
    And the following "core_webservice > Service function" exists:
53
      | service   | siteinfo                      |
54
      | functions | core_webservice_get_site_info |
55
    And the following "core_webservice > Tokens" exist:
56
      | user      | service                       | name           |
57
      | user2     | siteinfo                      | WEBservice1    |
58
      | user3     | moodle_mobile_app             | webservicE3     |
59
      | user4     | siteinfo                      | New service2   |
60
    When I log in as "admin"
61
    And I navigate to "Server > Web services > Manage tokens" in site administration
62
 
63
    # All created tokens are shown by default.
64
    And "Firstname1 Lastname1" "table_row" should not exist
65
    And I should see "Site information" in the "Firstname2 Lastname2" "table_row"
66
    And I should see "Moodle mobile web service" in the "Firstname3 Lastname3" "table_row"
67
    And I should see "Site information" in the "Firstname4 Lastname4" "table_row"
68
 
69
    # Filter tokens by by name (case-insensitive).
70
    And I click on "Tokens filter" "link"
71
    And I set the field "Name" to "webservice"
72
    And I press "Show only matching tokens"
73
    And I should see "Site information" in the "Firstname2 Lastname2" "table_row"
74
    And I should see "Moodle mobile web service" in the "Firstname3 Lastname3" "table_row"
75
    And "Firstname4 Lastname4" "table_row" should not exist
76
 
77
    # Reset the filter.
78
    And I press "Show all tokens"
79
    And I should see "Site information" in the "Firstname2 Lastname2" "table_row"
80
    And I should see "Moodle mobile web service" in the "Firstname3 Lastname3" "table_row"
81
    And I should see "Site information" in the "Firstname4 Lastname4" "table_row"
82
 
83
    # Filter tokens by user (note we can select the user by the identity field here).
84
    When I click on "Tokens filter" "link"
85
    And I set the field "User" to "user2@example.com"
86
    And I press "Show only matching tokens"
87
    Then "Firstname3 Lastname3" "table_row" should not exist
88
    And "Firstname4 Lastname4" "table_row" should not exist
89
    And I should see "Site information" in the "Firstname2 Lastname2" "table_row"
90
 
91
    # Reset the filter.
92
    And I press "Show all tokens"
93
    And I should see "Site information" in the "Firstname2 Lastname2" "table_row"
94
    And I should see "Moodle mobile web service" in the "Firstname3 Lastname3" "table_row"
95
    And I should see "Site information" in the "Firstname4 Lastname4" "table_row"
96
 
97
    # Filter tokens by service.
98
    And I click on "Tokens filter" "link"
99
    And I set the field "Service" to "Site information"
100
    And I press "Show only matching tokens"
101
    And I should see "Site information" in the "Firstname2 Lastname2" "table_row"
102
    And I should see "Site information" in the "Firstname4 Lastname4" "table_row"
103
    And "Firstname3 Lastname3" "table_row" should not exist