Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
201 lines (164 sloc) 11 KB

Testing

Testing Mozillians Code

  • To run mozillians.org tests:

    $ ./manage.py test
    
  • If you need a fresh test database:

    $ FORCE_DB=1 ./manage.py test
    
  • To run all tests in a class:

    $ ./manage.py test mozillians.users.tests.test_models:UserProfileTests
    
  • If you want to run a single test:

    $ ./manage.py test mozillians.users.tests.test_models:UserProfileTests.test_get_attribute_with_public_level
    

    to run only test_get_attribute_with_public_level test from the UserProfileTests class in the mozillians/users/tests/test_models.py test file.

Test Coverage

You can combine nose testing with the coverage module to get the code coverage of the tests. To get a coverage report for the 'users' package run:

$ coverage run --omit='*migrations*' manage.py test --noinput
$ coverage xml --omit='*migrations*' $(find mozillians -name '*.py')

Then visit htmlcov/index.html to get the coverage results.

Test Cases for NDA renewal feature

Verify that the inviter, who is also a group curator is able to renew a user membership 2 weeks before it expires
Preconditions:
  1. Create a closed group with terms in mozillians.org

  2. Set the membership to expire after several days (>14)

  3. Login as group curator and invite a mozillian to the closed group

  4. Login as the mozillian who was invited by curator and accept the invitation to the group and the terms

    • The mozillian becomes a group member
Steps:
  1. Verify that the group member will receive an email notification 2 weeks before their membership expires
  2. Verify that the inviter will receive an email notification 2 weeks before user's membership expires
  3. Login to mozillians.org as the inviter (and also group curator)
  4. Navigate to group's page
  5. Select “Renewals” option in filter dropdown, then click Filter button
  6. Click "Confirm Request" for user's membership renewal request
  7. Select “Members” option in filter dropdown, then click Filter button
  8. Verify that the user added in precondition is displayed in Group members section
Expected:
The user continues to be a member of the group, as the membership was renewed by inviter
Verify that a group curator is able to renew a user membership 2 weeks before it expires, if the inviter is no longer a curator
Preconditions:
  1. Create a reviewed group with terms

  2. Set the membership to expire after several days (>14)

  3. Login as group curator and invite a mozillian to the closed group

  4. Login as the mozillian who was invited by curator and accept the invitation to the group and the terms

    • The mozillian becomes a group member
  5. Add a new curator to the group and remove the initial curator (who is also the inviter) from the group curators list

Steps:
  1. Verify that the group member will receive an email notification 2 weeks before their membership expires
  2. Verify that the group curator will receive an email notification 2 weeks before user's membership expires
  3. Verify that the inviter will not receive an email notification 2 weeks before user's membership expires, as he/she is not a group curator anymore
  4. Login to mozillians.org as the group curator
  5. Navigate to group's page
  6. Select “Renewals” option in filter dropdown, then click Filter button
  7. Click "Confirm Request" for user's membership renewal request
  8. Select “Members” option in filter dropdown, then click Filter button
  9. Verify that the user added in precondition is displayed in Group members section
Expected:
The user continues to be a member of the group, as the membership was renewed by curator
Verify the status of a user whose membership to an open group without terms reached expiration date
Preconditions:
  1. Create an open group
  2. Set the membership to expire after several days (>14)
  3. Have a user who joined the group
Steps:
  1. Login to mozillians.org as the curator of the open group, when the membership reached the expiration date
  2. Navigate to group page
  3. Select “Members” option in filter dropdown, then click Filter button
  4. Verify that the user added in precondition is no longer displayed in Group members section (it was removed)
Expected:
The user is not a group member. The user will receive an email “Removed from Mozillians group “X””
Verify the status of a user whose membership to a reviewed group without terms reached expiration date
Preconditions:
  1. Create a reviewed group with no terms
  2. Set the membership to expire after several days (>14)
  3. Have a user added to the group
Steps:
  1. Verify that the user will receive an email notification when the membership reached the expiration date (“Status changed for Mozillians group “X””)
  2. Login to mozillians.org as the curator of the reviewed group, when the membership reached the expiration date
  3. Navigate to group page
  4. Select “Members” option in filter dropdown, then click Filter button
  5. Verify that the user added in precondition is no longer displayed in Group members section
  6. Select “Pending Members” option in filter dropdown, then click Filter button
  7. Verify that the user added in precondition is displayed in Group members section
  8. Click “Confirm Request” for that user
  9. Select “Members” option in filter dropdown, then click Filter button
  10. Verify that the user added in precondition is displayed in Group members section
Expected:
After step 8: The user should receive an email saying “Accepted to Mozillians group “X”” After step 10: The user is a member of the group again
Verify the status of a user whose membership to a reviewed group with terms reached expiration date
Preconditions:
  1. Create a reviewed group with terms
  2. Set the membership to expire after several days (>14)
  3. Have a user added to the group
Steps:
  1. Verify that the user will receive an email notification when the membership reached the expiration date (“Status changed for Mozillians group “X””)
  2. Login to mozillians.org as the curator of the reviewed group, when the membership reached the expiration date
  3. Navigate to group page
  4. Select “Members” option in filter dropdown, then click Filter button
  5. Verify that the user added in precondition is no longer displayed in Group members section
  6. Select “Pending Members” option in filter dropdown, then click Filter button
  7. Verify that the user added in precondition is displayed in Group members section
  8. Click “Confirm Request” for that user
  9. Select “Pending Terms” option in filter dropdown, then click Filter button
  10. Verify that the user added in precondition is displayed in Group members section
Expected:
After step 8: The user should receive an email saying “Accepted to Mozillians group “X”” After step 10: If the user accepts the terms, he/she will be member of the group again
Verify the status of a user whose membership to a closed group without terms reached expiration date
Preconditions:
  1. Create a closed group with no terms.
  2. Set the membership to expire after several days (>14).
  3. Have a user added to the group.
Steps:
  1. Verify that the user will receive an email notification when the membership reached the expiration date (“Status changed for Mozillians group “X””)
  2. Login to mozillians.org as the curator of the reviewed group, when the membership reached the expiration date
  3. Navigate to group page
  4. Select “Members” option in filter dropdown, then click Filter button
  5. Verify that the user added in precondition is no longer displayed in Group members section
  6. Select “Pending Members” option in filter dropdown, then click Filter button
  7. Verify that the user added in precondition is displayed in Group members section
  8. Click “Confirm Request” for that user
  9. Select “Members” option in filter dropdown, then click Filter button
  10. Verify that the user added in precondition is displayed in Group members section
Expected:
After step 8: The user should receive an email saying “Accepted to Mozillians group “X”” After step 10: The user is a member of the group again
Verify the status of a user whose membership to a closed group with terms reached expiration date
Preconditions:
  1. Create a closed group with terms
  2. Set the membership to expire after several days (>14)
  3. Have a user added to the group
Steps:
  1. Verify that the user will receive an email notification when the membership reached the expiration date (“Status changed for Mozillians group “X””)
  2. Login to mozillians.org as the curator of the closed group, when the membership reached the expiration date
  3. Navigate to group page
  4. Select “Members” option in filter dropdown, then click Filter button
  5. Verify that the user added in precondition is no longer displayed in Group members section
  6. Select “Pending Members” option in filter dropdown, then click Filter button
  7. Verify that the user added in precondition is displayed in Group members section
  8. Click “Confirm Request” for that user
  9. Select “Pending Terms” option in filter dropdown, then click Filter button
  10. Verify that the user added in precondition is displayed in Group members section
Expected:
After step 8: The user should receive an email saying “Accepted to Mozillians group “X”” After step 10: If the user accepts the terms, he/she will be member of the group again
Verify the status of a user whose request to join a group (with membership set to expire) was never accepted by the curator
Precondition:
  1. Create a reviewed group with no terms
  2. Set the membership to expire in a few days
  3. Have a user who submitted a request to join the group
Steps:
  1. Login to mozillians.org as the curator of the group, when the membership reached the expiration date
  2. Navigate to group page
  3. Select “All” option in filter dropdown, then click Filter button
  4. Verify that the user added in precondition is not displayed in Group members section (the user was removed)
Expected:
The user is not a member of the group The user will receive an email “Removed from Mozillians group “X””
You can’t perform that action at this time.