MDL-40669 tool_uploaduser: set emailstop during upload Behat test.
authorPaul Holden <paulh@moodle.com>
Wed, 18 Sep 2019 20:41:28 +0000 (21:41 +0100)
committerPaul Holden <paulh@moodle.com>
Wed, 18 Sep 2019 20:41:28 +0000 (21:41 +0100)
admin/tool/uploaduser/tests/behat/upload_users.feature
lib/tests/fixtures/upload_users_emailstop.csv [new file with mode: 0644]

index 7ac75ba..a92b633 100644 (file)
@@ -51,6 +51,7 @@ Feature: Upload users
     And I navigate to "Users > Accounts > Upload users" in site administration
     When I upload "lib/tests/fixtures/upload_users.csv" file to "File" filemanager
     And I press "Upload users"
+    And I should see "Upload users preview"
     And I set the following fields to these values:
       | City/town  | Brighton   |
       | Department | Purchasing |
@@ -77,6 +78,7 @@ Feature: Upload users
     When I navigate to "Users > Accounts > Upload users" in site administration
     And I upload "lib/tests/fixtures/upload_users_profile.csv" file to "File" filemanager
     And I press "Upload users"
+    And I should see "Upload users preview"
     And I press "Upload users"
     # Check that users were created and the superfield is filled.
     And I navigate to "Users > Accounts > Browse list of users" in site administration
@@ -85,6 +87,21 @@ Feature: Upload users
     And I should see "The big guy"
     And I log out
 
+  @javascript
+  Scenario: Upload users setting their email stop value
+    Given I log in as "admin"
+    And I navigate to "Users > Accounts > Upload users" in site administration
+    When I upload "lib/tests/fixtures/upload_users_emailstop.csv" file to "File" filemanager
+    And I press "Upload users"
+    Then I should see "Upload users preview"
+    And the following should exist in the "uupreview" table:
+      | CSV line | username | emailstop |
+      | 2        | jbloggs  | 1         |
+      | 3        | fbloggs  | 0         |
+    And I press "Upload users"
+    And I should see "Users created: 2"
+    And I log out
+
   @javascript
   Scenario: Upload users setting their user theme
     Given the following "courses" exist:
@@ -170,4 +187,4 @@ Feature: Upload users
     Then I should see "2 January 2020" in the "Enrolment starts" "table_row"
     And I should see "12 January 2020" in the "Enrolment ends" "table_row"
     And I click on "Close" "button"
-    And I log out
+    And I log out
\ No newline at end of file
diff --git a/lib/tests/fixtures/upload_users_emailstop.csv b/lib/tests/fixtures/upload_users_emailstop.csv
new file mode 100644 (file)
index 0000000..9231390
--- /dev/null
@@ -0,0 +1,3 @@
+username,password,firstname,lastname,email,emailstop
+jbloggs,hunter42,Joe,Bloggs,jbloggs@example.com,1
+fbloggs,hunter42,Fred,Bloggs,fbloggs@example.com,0