本文整理汇总了Python中unittestzero.Assert类的典型用法代码示例。如果您正苦于以下问题:Python Assert类的具体用法?Python Assert怎么用?Python Assert使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Assert类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_that_verifies_the_tooltip_for_Other_Applications
def test_that_verifies_the_tooltip_for_Other_Applications(self, mozwebqa):
"""
Litmus 22925
https://litmus.mozilla.org/show_test.cgi?id=22925
"""
amo_home_page = AddonsHomePage(mozwebqa)
Assert.equal(amo_home_page.header.other_applications_tooltip, 'Find add-ons for other applications')
示例2: test_that_resources_page_display_makes
def test_that_resources_page_display_makes(self, mozwebqa):
home_page = HomePage(mozwebqa)
home_page.go_to_page()
resources_page = home_page.header.click_teach_tab()
Assert.greater(resources_page.teach_make_count, 0)
Assert.true(resources_page.is_teach_makes_visible)
示例3: test_that_events_front_page_shows_upcoming_events
def test_that_events_front_page_shows_upcoming_events(self, mozwebqa):
home_page = HomePage(mozwebqa)
home_page.go_to_page()
events_page = home_page.header.go_to_events_page()
Assert.true(events_page.upcoming_events_count > 0)
Assert.true(events_page.upcoming_events_is_visible)
示例4: test_cant_find_what_youre_looking_for_test
def test_cant_find_what_youre_looking_for_test(self, mozwebqa, search_term):
search_page_obj = PageProvider(mozwebqa).search_page()
search_page_obj.do_search_on_search_box(search_term)
expected_text = "Can't find what you're looking for?"
Assert.contains(expected_text, search_page_obj.ask_a_question_text)
Assert.true(search_page_obj.is_ask_a_question_present, "Ask question link not present")
示例5: test_creating_profile_without_checking_privacy_policy_checkbox
def test_creating_profile_without_checking_privacy_policy_checkbox(self, mozwebqa):
user = self.get_new_user()
home_page = Home(mozwebqa)
profile = home_page.create_new_user(user)
profile.set_full_name("User that doesn't like policy")
profile.set_bio("Hello, I'm new here and trying stuff out. Oh, and by the way: I'm a robot, run in a cronjob, and will not check accept the privacy policy")
skills = profile.click_next_button()
skills.add_skill('test')
skills.add_language('english')
location = skills.click_next_button()
location.select_country('us')
location.set_state('California')
location.set_city('Mountain View')
location.click_create_profile_button()
profile = ProfileTab(mozwebqa)
Assert.equal('new error message', profile.error_message)
location = profile.go_to_tab('location')
Assert.equal('This field is required.', location.privacy_error_message)
示例6: test_filter_results_by_location
def test_filter_results_by_location(self, mozwebqa):
query = u"Greece"
home_page = Home(mozwebqa)
events_page = home_page.header.click_events_link()
events_page.filter_for(query)
Assert.contains(u"Greece", events_page.event_profile_location_text)
示例7: test_that_clicking_on_a_subcategory_loads_expected_page
def test_that_clicking_on_a_subcategory_loads_expected_page(self, mozwebqa):
"""test for litmus 15949"""
home_page = Home(mozwebqa)
themes_page = home_page.click_themes()
selected_category = themes_page.themes_category
amo_category_page = themes_page.click_on_first_category()
Assert.equal(selected_category, amo_category_page.title)
示例8: test_sorting_by_downloads
def test_sorting_by_downloads(self, mozwebqa):
""" Litmus 17342
https://litmus.mozilla.org/show_test.cgi?id=17342 """
AddonsHomePage(mozwebqa).header.search_for('firebug')
amo_search_page = AddonsSearchHomePage(mozwebqa).sort_by('downloads')
Assert.true('sort=weeklydownloads' in amo_search_page.get_url_current_page())
Assert.is_sorted_descending([i.downloads for i in amo_search_page.results()])
示例9: test_sorting_by_updated_date
def test_sorting_by_updated_date(self, mozwebqa):
""" Litmus 17345
https://litmus.mozilla.org/show_test.cgi?id=17345 """
AddonsHomePage(mozwebqa).header.search_for('firebug')
amo_search_page = AddonsSearchHomePage(mozwebqa).sort_by('updated')
Assert.true('sort=updated' in amo_search_page.get_url_current_page())
Assert.is_sorted_descending([i.updated_date for i in amo_search_page.results()])
示例10: test_that_verifies_categories_menu
def test_that_verifies_categories_menu(self, mozwebqa):
home_page = Home(mozwebqa)
home_page.go_to_homepage()
categories = home_page.nav_menu.click_categories()
Assert.greater(len(categories.categories), 0)
示例11: test_the_search_field_placeholder
def test_the_search_field_placeholder(self, mozwebqa):
"""
Litmus 4826
https://litmus.mozilla.org/show_test.cgi?id=4826
"""
amo_home_page = AddonsHomePage(mozwebqa)
Assert.equal(amo_home_page.header.search_field_placeholder, 'search for add-ons')
示例12: test_that_a_screenshot_can_be_added
def test_that_a_screenshot_can_be_added(self, mozwebqa):
"""Test the happy path for adding a screenshot for a free submitted app.
Litmus link: https://litmus.mozilla.org/show_test.cgi?id=50479
"""
dev_home = Home(mozwebqa)
dev_home.go_to_developers_homepage()
dev_home.login(user="default")
my_apps = dev_home.header.click_my_submissions()
edit_listing = my_apps.first_free_app.click_edit()
before_screenshots_count = len(edit_listing.screenshots_previews)
# bring up the media form for the first free app
media_region = edit_listing.click_edit_media()
screenshots_count = len(media_region.screenshots)
# upload a new screenshot
media_region.screenshot_upload(self._get_resource_path('img.jpg'))
# check that the screenshot list is updated
new_screenshots_count = len(media_region.screenshots)
Assert.equal(screenshots_count + 1, new_screenshots_count,
'Expected %s screenshots, but there are %s.' % (screenshots_count + 1, new_screenshots_count))
# save the changes
media_region.click_save_changes()
# check that the icon preview has been updated
after_screenshots_count = len(edit_listing.screenshots_previews)
Assert.equal(before_screenshots_count + 1, len(edit_listing.screenshots_previews),
'Expected %s screenshots, but there are %s.' % (before_screenshots_count + 1, after_screenshots_count))
示例13: test_that_checks_editing_support_information_for_a_free_app
def test_that_checks_editing_support_information_for_a_free_app(self, mozwebqa):
"""
Test edit support information for a free app.
Pivotal task: https://www.pivotaltracker.com/story/show/27741207
Litmus: https://litmus.mozilla.org/show_test.cgi?id=50481
"""
updated_app = MockApplication()
dev_home = Home(mozwebqa)
dev_home.go_to_developers_homepage()
dev_home.login(user="default")
my_apps = dev_home.header.click_my_submissions()
edit_listing = my_apps.first_free_app.click_edit()
# update fields in support information
support_info_region = edit_listing.click_support_information()
support_info_region.type_support_email(updated_app['support_email'])
support_info_region.type_support_url(updated_app['support_website'])
support_info_region.click_save_changes()
# Verify the changes have been made
Assert.equal(edit_listing.email, updated_app['support_email'])
Assert.equal(edit_listing.website, updated_app['support_website'])
示例14: test_assert_that_a_app_can_be_added_by_api
def test_assert_that_a_app_can_be_added_by_api(self, mozwebqa):
mock_app = MockApplication() # generate mock app
mock_app.name = "API %s" % mock_app.name
# init API client
mk_api = MarketplaceAPI.get_client(mozwebqa.base_url, mozwebqa.credentials)
mk_api.submit_app(mock_app) # submit app
app_status = mk_api.app_status(mock_app) # get app data from API
# Selenium
dev_home = Home(mozwebqa)
dev_home.go_to_developers_homepage()
dev_home.login(user="default")
dev_submissions = dev_home.header.click_my_submissions()
dev_submissions.sorter.sort_by("created")
apps = dev_submissions.submitted_apps
app_names = []
for app in apps:
app_names.append(app.name)
Assert.contains(app_status["name"], app_names)
示例15: test_advanced_options_are_visible
def test_advanced_options_are_visible(self, mozwebqa):
home_page = Home(mozwebqa)
events_page = home_page.header.click_events_link()
events_page.click_advanced_options()
Assert.true(events_page.is_advanced_search_form_visible)
Assert.true(events_page.is_events_icalendar_export_button_visible)