def splice_check_report(typeinstance, days_start=None, days_end=None, past_hours=None, state=[u'Active', u'Inactive', u'Deleted'], current=0, invalid=0, insufficient=0, organizations=[u'Testing Org']): report_page = None KATELLO = typeinstance.KATELLO SE.reset(url=KATELLO.url) if days_start is not None and days_end is not None: # date-range mode start_date, end_date = report.date_ago(days_start), report.date_ago(days_end) filter_name = report.dates_filter_name(start_date, end_date, state) with typeinstance._env_ctx(KATELLO.url, KATELLO.user, KATELLO.password, organizations[0]): with filter_date_range_ctx( name=filter_name, start_date=start_date, end_date=end_date, organizations=organizations, lifecycle_states=state ) as (filters_page, report_filter): report_page = report_filter.run_report() # assert the values nose.tools.assert_equal(report_page.current_subscriptions.count.text, unicode(current)) nose.tools.assert_equal(report_page.insufficient_subscriptions.count.text, unicode(insufficient)) nose.tools.assert_equal(report_page.invalid_subscriptions.count.text, unicode(invalid)) elif past_hours is not None: # hours-based operation filter_name = report.hours_filter_name(past_hours, state) with typeinstance._env_ctx(KATELLO.url, KATELLO.user, KATELLO.password, organizations[0]): with filter_hours_ctx( name=filter_name, hours=past_hours, organizations=organizations, lifecycle_states=state ) as (filters_page, report_filter): report_page = report_filter.run_report() # assert the values nose.tools.assert_equal(report_page.current_subscriptions.count.text, unicode(current)) nose.tools.assert_equal(report_page.insufficient_subscriptions.count.text, unicode(insufficient)) nose.tools.assert_equal(report_page.invalid_subscriptions.count.text, unicode(invalid)) else: # Wrong usage assert False, "Wrong usage" return # not reached
def setUpClass(cls): # override default in order not to do login --- done within the contexts here SE.reset(driver=SELENIUM.driver, url=KATELLO.url) SE.maximize_window() cls.details = filters.DEFAULT_FILTER_DETAILS
def setUpClass(cls): SE.reset(driver='firefox', url="http://en.wikipedia.org")
def setUpClass(cls): # reset SE driver SE.reset(driver=SELENIUM.driver, url=KATELLO.url)
def setUpClass(cls): '''all these test cases require user logged in''' SE.reset(driver=SELENIUM.driver, url=KATELLO.url) SE.maximize_window() with restore_url(): login(KATELLO.username, KATELLO.password)
def splice_check_report(typeinstance, days_start=None, days_end=None, past_hours=None, state=[u'Active', u'Inactive', u'Deleted'], current=0, invalid=0, insufficient=0, organizations=[u'Testing Org']): report_page = None KATELLO = typeinstance.KATELLO SE.reset(url=KATELLO.url) if days_start is not None and days_end is not None: # date-range mode start_date, end_date = report.date_ago( days_start), report.date_ago(days_end) filter_name = report.dates_filter_name(start_date, end_date, state) with typeinstance._env_ctx(KATELLO.url, KATELLO.user, KATELLO.password, organizations[0]): with filter_date_range_ctx( name=filter_name, start_date=start_date, end_date=end_date, organizations=organizations, lifecycle_states=state) as (filters_page, report_filter): report_page = report_filter.run_report() # assert the values nose.tools.assert_equal( report_page.current_subscriptions.count.text, unicode(current)) nose.tools.assert_equal( report_page.insufficient_subscriptions.count.text, unicode(insufficient)) nose.tools.assert_equal( report_page.invalid_subscriptions.count.text, unicode(invalid)) elif past_hours is not None: # hours-based operation filter_name = report.hours_filter_name(past_hours, state) with typeinstance._env_ctx(KATELLO.url, KATELLO.user, KATELLO.password, organizations[0]): with filter_hours_ctx( name=filter_name, hours=past_hours, organizations=organizations, lifecycle_states=state) as (filters_page, report_filter): report_page = report_filter.run_report() # assert the values nose.tools.assert_equal( report_page.current_subscriptions.count.text, unicode(current)) nose.tools.assert_equal( report_page.insufficient_subscriptions.count.text, unicode(insufficient)) nose.tools.assert_equal( report_page.invalid_subscriptions.count.text, unicode(invalid)) else: # Wrong usage assert False, "Wrong usage" return # not reached