functional_tests Package

functional_tests Package

A separate app containing all functional tests for the project.

models Module

tests Module

Functional tests for Distro Tracker.

class functional_tests.tests.ChangeProfileTest(methodName='runTest')[source]

Bases: functional_tests.tests.UserAccountsTestMixin, functional_tests.tests.SeleniumTestCase

test_change_password()[source]

Tests that the user can change their password upon logging in.

test_manage_account_emails()[source]

Tests that the user can manage which email addresses are associated with their account.

test_merge_accounts()[source]
test_modify_personal_info()[source]

Tests that the user is able to change their personal info upon logging in.

test_reset_password()[source]

Tests that a user is able to reset their password if they forgot it.

class functional_tests.tests.PackagePageTest(methodName='runTest')[source]

Bases: functional_tests.tests.SeleniumTestCase

get_package_url(package_name)[source]

Helper method returning the URL of the package with the given name.

send_text_to_package_search_form(text)[source]

Helper function to send text input to the package search form.

setUp()[source]
test_access_package_page_from_index()[source]

Tests that the user can access a package page starting from the index and using the provided form.

test_access_source_package_page_by_url()[source]

Tests that users can get to a package’s page by going straight to its URL.

test_include_panel_center()[source]
test_include_panel_left()[source]
test_include_panel_right()[source]
class functional_tests.tests.RepositoryAdminTest(methodName='runTest')[source]

Bases: functional_tests.tests.SeleniumTestCase

login_to_admin(username='admin', password='admin')[source]

Helper method which logs the user with the given credentials to the admin console.

setUp()[source]
test_repository_add(mock_requests, mock_requests2)[source]

Tests that an admin user is able to add a new repository.

class functional_tests.tests.SeleniumTestCase(methodName='runTest')[source]

Bases: distro_tracker.test.LiveServerTestCase

A class which includes some common functionality for all tests which use Selenium.

absolute_url(relative)[source]

Helper method which builds an absolute URL where the live_server_url is the root.

assert_current_url_equal(url)[source]

Helper method which asserts that the given URL equals the current browser URL. The given URL should not include the domain.

assert_element_with_class_in_page(class_name, custom_message=None)[source]
assert_element_with_id_in_page(element_id, custom_message=None)[source]

Helper method which asserts that the element with the given ID can be found in the current browser page.

assert_in_page_body(text)[source]
assert_not_in_page_body(text)[source]
clear_element_text(id)[source]

Helper method which removes any text already found in the element with the given ID.

Helper method which clicks on the link with the given text.

get_element_by_class(class_name)[source]
get_element_by_id(element_id)[source]
get_page(relative)[source]

Helper method which points the browser to the absolute URL based on the given relative URL and the server’s live_server_url.

input_to_element(id, text)[source]

Helper method which sends the text to the element with the given ID.

send_enter(id)[source]

Helper method which sends the enter key to the element with the given ID.

setUp()[source]
set_mock_http_response(mock_requests, text, status_code=200)[source]
tearDown()[source]
wait_response(seconds)[source]
class functional_tests.tests.SubscribeToPackageTest(methodName='runTest')[source]

Bases: functional_tests.tests.UserAccountsTestMixin, functional_tests.tests.SeleniumTestCase

Tests for stories regarding subscribing to a package over the Web.

get_subscriptions_url()[source]
test_package_subscription_no_email_from_subscription_tab_fails()[source]

The UI should prevent the user from forgetting to check at least one email checkbox from the subscription tab in its personnal space.

test_package_subscription_no_package_from_subscription_tab_fails()[source]

The UI should prevent the user from forgetting to check at least one email checkbox from the subscription tab in its personnal space.

test_subscribe_from_package_page()[source]

Tests that a user that has only one email address can subscribe to a package directly from the package page.

test_subscribe_multiple_associated_emails()[source]

Tests that a user with multiple associated email addresses is offered a choice which address to use to subscribe to a package.

test_subscribe_not_logged_in()[source]

Tests that when a user is not logged in, the response redirects to the log in page instead of subscribing to the package.

test_subscribe_package_from_subscription_tab()[source]

This test validates that a user can correctly subscribe to a package from the subscription tab in its personnal space.

test_unsubscribe_all_emails()[source]

Tests unsubscribing all user’s emails from a package.

class functional_tests.tests.TeamTests(methodName='runTest')[source]

Bases: functional_tests.tests.UserAccountsTestMixin, functional_tests.tests.SeleniumTestCase

assert_team_packages_equal(team, package_names)[source]
get_create_team_url()[source]
get_delete_team_url(team_name)[source]
get_subscriptions_url()[source]
get_team_deleted_url()[source]
get_team_manage_url(team_name)[source]
get_team_url(team_name)[source]
get_update_team_url(team_name)[source]
test_create_team()[source]

Tests that a logged in user can create a new team.

test_create_team_maintainer_email()[source]

Tests creating a team with a maintainer email set. The team should become automatically associated with the maintainer’s packages.

test_delete_team()[source]

Tests that the owner can delete a team.

test_owner_team_management()[source]

Tests that a team owner is able to add/remove members from a separate panel.

test_package_management()[source]

Tests that adding/removing packages from the team works as expected.

test_team_access()[source]

Tests joining and leaving a team.

test_toggle_team_mute()[source]

Tests that a team member is able to mute and unmute a team membership from the subscription details page.

test_update_team()[source]

Tests that the team owner can update the team’s basic info.

class functional_tests.tests.UserAccountsTestMixin[source]

Bases: object

Defines some common methods for all user account tests.

create_user(main_email, password, associated_emails=())[source]
get_login_url()[source]
get_package_url(package_name)[source]
get_profile_url()[source]
log_in(user=None, password=None)[source]

Helper method which logs the user in, without taking any shortcuts (it goes through the steps to fill in the form and submit it).

log_out()[source]

Helper method which logs the user out.

refresh_user_object()[source]

The method retrieves the user instance from the database forcing any cached properties to reload. This can be used when the user’s properties need to be tested for updated values.

setUp()[source]
class functional_tests.tests.UserRegistrationTest(methodName='runTest')[source]

Bases: functional_tests.tests.UserAccountsTestMixin, functional_tests.tests.SeleniumTestCase

Tests for the user registration story.

get_confirmation_url(message)[source]

Extracts the confirmation URL from the given email message. Returns None if the message did not contain a confirmation URL.

get_registration_url()[source]
setUp()[source]
test_login()[source]

Tests that a user can log in when they already have an account.

test_login_associated_email()[source]

Tests that a user can log in with an associated email.

test_logout_from_package_page()[source]

If a user logs out when on the package page, the response should not redirect to the index.

test_register_email_already_has_subscriptions()[source]

Tests that a user can register using an email which already has subscriptions to some packages.

test_user_register()[source]
test_user_registered()[source]

Tests that a user registration fails when there is already a registered user with the given email.

functional_tests.tests.create_test_panel(panel_position)[source]

Helper test decorator which creates a TestPanel before running the test and unregisters it when it completes, making sure all tests are ran in isolation.