Uploaded image for project: 'OpenMRS Core'
  1. OpenMRS Core
  2. TRUNK-5484

Fix Failing test for setUserActivationKey_shouldCreateUserActivationKey

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Should
    • Resolution: Fixed
    • Affects Version/s: Core 2.2.0
    • Fix Version/s: Core 2.3.0
    • Component/s: None
    • Labels:
    • Complexity:
      Low

      Description

      During running of  Tests when your environment is not fully set to send email. the setUserActivationKey_shouldCreateUserActivationKey after setting the activation key as expected throws a message exception. So this issue is about catching the exception that is thrown  Or adding to the function to expect that exception during test environment.

      This line generating the error is  https://github.com/openmrs/openmrs-core/blob/master/api/src/test/java/org/openmrs/api/UserServiceTest.java#L1406 ,

      So instead of asserting if the returned user by the setUserActivationKey is the same as the createdUser check instead for the MessageException that will be thrown by that function since when no email is provided or assuming your system is not fully configured to send emails when the function tries to send an email it fails with a message exception. and to guarantee that the function does what its supposed to do the following line asserts that the activation key was created.

      Similar implimentation can be found here 

        Attachments

          Activity

            People

            Assignee:
            wandji69 Wandji Collins
            Reporter:
            harisu harisu fanyui [X] (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 5 minutes Original Estimate - 5 minutes
                5m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 15 minutes
                15m