Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-61786

auth_db's Test Settings output doesn't use language strings

XMLWordPrintable

    • MOODLE_34_STABLE, MOODLE_35_STABLE, MOODLE_36_STABLE
    • MOODLE_34_STABLE, MOODLE_35_STABLE
    • wip-MDL-61786-master
    • Hide

      Summary

      Ensure all strings moved to auth/db/lang/en/auth_db.php still appear as expected. The tests are sequential, i.e. subsequent tests assume the site is configured as per previous tests. These tests to be performed logged in as a site administrator.

      Prerequisites

      1. Start with a new site with External Database authentication not configured.
      2. Create a test database. These steps assume MySQL (or MariaDB) is in use on the same server as the web server, revise the steps accordingly for other scenarios.
        1. Run the following statements:
          CREATE DATABASE MDL_61786 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
          CREATE TABLE MDL_61786.user (username VARCHAR(50) UNIQUE, password VARCHAR(50));
          CREATE USER 'MDL_61786'@'localhost' IDENTIFIED BY 'test-password';
          GRANT SELECT ON MDL_61786.user TO 'MDL_61786'@'localhost';

      Test 1: No settings

      1. Browse to Site administrationPluginsAuthentication →  Manage authentication.
      2. Click the Test settings link for External database.

      Expected results: Error message "External table not specified".

      Test 2: Database name only

      1. Browse to Site administrationPluginsAuthentication →  Manage authentication.
      2. Click the Settings link for External database.
      3. Configure the following:
        1. DB name (auth_db | name): MDL_61786
        2. DB user (auth_db | user): MDL_61786
        3. Password (auth_db | pass): test-password
        4. Table (auth_db | table): user
      4. Click Save changes.
      5. Browse to Site administrationPluginsAuthentication →  Manage authentication.
      6. Click the Test settings link for External database.

      Expected results: Error message "External user field not specified.".

      Test 3: Correct configuration, empty table

      1. Browse to Site administrationPluginsAuthentication →  Manage authentication.
      2. Click the Settings link for External database.
      3. Configure the following:
        1. Username field (auth_db | fielduser): username
      4. Click Save changes.
      5. Browse to Site administrationPluginsAuthentication →  Manage authentication.
      6. Click the Test settings link for External database.

      Expected results: Error message "External table is empty."

      Test 4: Correct configuration, user present

      1. Add a user to the test database:
            INSERT INTO MDL_61786.user (username, password) VALUES ('fred', 'secret');
      2. Browse to Site administrationPluginsAuthentication →  Manage authentication.
      3. Click the Test settings link for External database.

      Expected results: Message "External table contains the following columns: username, password".

      Test 5: Invalid database name

      1. Browse to Site administrationPluginsAuthentication →  Manage authentication.
      2. Click the Settings link for External database.
      3. Configure the following:
        1. DB name (auth_db | name): non_existent
      4. Click Save changes.
      5. Browse to Site administrationPluginsAuthentication →  Manage authentication.
      6. Click the Test settings link for External database.

      Expected results: Error message "Cannot connect to external database."

      Test 6: Invalid user table

      1. Browse to Site administrationPluginsAuthentication →  Manage authentication.
      2. Click the Settings link for External database.
      3. Configure the following:
        1. DB name (auth_db | name): MDL_61786
        2. Table (auth_db | table): non_existent
      4. Click Save changes.
      5. Browse to Site administrationPluginsAuthentication →  Manage authentication.
      6. Click the Test settings link for External database.

      Expected results: Error message "Cannot read external table."

      Post-testing steps

      1. Remove the following database objects:
        1. Authentication database MDL_61786:
                  DROP DATABASE MDL_61786;
        2. Database user MDL_61786:
                  DROP USER 'MDL_61786'@'localhost' ;
      Show
      Summary Ensure all strings moved to auth/db/lang/en/auth_db.php still appear as expected. The tests are sequential, i.e. subsequent tests assume the site is configured as per previous tests. These tests to be performed logged in as a site administrator. Prerequisites Start with a new site with External Database authentication not configured. Create a test database. These steps assume MySQL (or MariaDB) is in use on the same server as the web server, revise the steps accordingly for other scenarios. Run the following statements: CREATE DATABASE MDL_61786 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; CREATE TABLE MDL_61786.user (username VARCHAR(50) UNIQUE, password VARCHAR(50)); CREATE USER 'MDL_61786'@'localhost' IDENTIFIED BY 'test-password'; GRANT SELECT ON MDL_61786.user TO 'MDL_61786'@'localhost'; Test 1: No settings Browse to Site administration → Plugins → Authentication →  Manage authentication . Click the Test settings link for External database . Expected results: Error message "External table not specified". Test 2: Database name only Browse to Site administration → Plugins → Authentication →  Manage authentication . Click the Settings link for External database . Configure the following: DB name (auth_db | name): MDL_61786 DB user (auth_db | user): MDL_61786 Password (auth_db | pass): test-password Table (auth_db | table): user Click Save changes . Browse to Site administration → Plugins → Authentication →  Manage authentication . Click the Test settings link for External database . Expected results: Error message "External user field not specified.". Test 3: Correct configuration, empty table Browse to Site administration → Plugins → Authentication →  Manage authentication . Click the Settings link for External database . Configure the following: Username field (auth_db | fielduser): username Click Save changes . Browse to Site administration → Plugins → Authentication →  Manage authentication . Click the Test settings link for External database . Expected results: Error message "External table is empty." Test 4: Correct configuration, user present Add a user to the test database:     INSERT INTO MDL_61786.user (username, password) VALUES ('fred', 'secret'); Browse to Site administration → Plugins → Authentication →  Manage authentication . Click the Test settings link for External database . Expected results: Message "External table contains the following columns: username, password". Test 5: Invalid database name Browse to Site administration → Plugins → Authentication →  Manage authentication . Click the Settings link for External database . Configure the following: DB name (auth_db | name): non_existent Click Save changes . Browse to Site administration → Plugins → Authentication →  Manage authentication . Click the Test settings link for External database . Expected results: Error message "Cannot connect to external database." Test 6: Invalid user table Browse to Site administration → Plugins → Authentication →  Manage authentication . Click the Settings link for External database . Configure the following: DB name (auth_db | name): MDL_61786 Table (auth_db | table): non_existent Click Save changes . Browse to Site administration → Plugins → Authentication →  Manage authentication . Click the Test settings link for External database . Expected results: Error message "Cannot read external table." Post-testing steps Remove the following database objects: Authentication database MDL_61786 :         DROP DATABASE MDL_61786; Database user MDL_61786 :         DROP USER 'MDL_61786'@'localhost' ;

      The external database authentication plugin (auth_db) has a "Test settings" link (under Site administrationPluginsAuthentication) to test the configuration. The messages that appear as a result of this are all hardcoded as opposed to being language strings. This means that they can't be translated nor updated via AMOS.

      E.g. line 772 of auth/db/auth.php:

                  echo $OUTPUT->notification('External user field not specified.', 'notifyproblem');

            leonstr Leon Stringer
            leonstr Leon Stringer
            Adrian Greeve Adrian Greeve
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            David Mudrák (@mudrd8mz) David Mudrák (@mudrd8mz)
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.