def test_title(resp, section, property_name): dj_assert_contains(resp, getattr(section, property_name))
def test_basic_contents(resp, webinar, property_name): dj_assert_contains(resp, getattr(webinar, property_name))
def test_subscription_link_is_present(resp): dj_assert_contains(resp, reverse('checkout:bootcamp_lp'))
def test_max_creation(resp, interactions): tz = timezone.get_current_timezone() last_interaction_utc = datetime(2019, 7, 22, 1, 0, 0, tzinfo=pytz.utc) last_interaction_local = last_interaction_utc.astimezone(tz).strftime( '%d/%m/%Y %H:%M:%S') dj_assert_contains(resp, last_interaction_local)
def test_total_watched_time(resp, interactions: List[TopicInteraction]): total_watched_time = sum(interaction.total_watched_time for interaction in interactions) total_watched_time_str = duration(total_watched_time) dj_assert_contains(resp, total_watched_time_str)
def test_topic_title_is_present(resp, topic): dj_assert_contains(resp, topic.title)
def test_topic_url(resp, topic: Topic): dj_assert_contains(resp, topic.get_absolute_url())
def test_cohort_url(cohort: Cohort, resp): dj_assert_contains(resp, cohort.get_absolute_url())
def test_payment_link_is_present(home_resp_open_subscriptions): """ Assert Payment link is present on home page when subscriptions are open """ dj_assert_contains(home_resp_open_subscriptions, reverse('member_landing_page'))
def test_cohort_title(cohort, resp): dj_assert_contains(resp, cohort.title)
def test_pending_live_class_msg(resp_video_not_recorded): dj_assert_contains( resp_video_not_recorded, 'Ainda não temos máquina do tempo, essa aula ainda não foi gravada') dj_assert_contains(resp_video_not_recorded, 'Retornar à página da turma')
def test_basic_contents(resp, live_class, property_name): dj_assert_contains(resp, getattr(live_class, property_name))
def test_breadcrumb_current(resp, section): dj_assert_contains( resp, f'<li class="breadcrumb-item active" aria-current="page">{section.title}</li>' )
def test_breadcrumb_parent(resp, module): dj_assert_contains( resp, f'<li class="breadcrumb-item"><a href="{module.get_absolute_url()}">{module.title}</a></li>' )
def test_should_set_date_by_url(client): resp = client.get( reverse('pages:tpp_webiorico_landing_page_date_var', args=['13-10'])) assert resp.status_code == 200 dj_assert_contains(resp, '13/10')
def test_email_field_is_present(resp): dj_assert_contains(resp, 'https://python.activehosted.com/f/embed.php?id=2')
def test_not_existing_aggregation_msg_is_present(resp_without_interactions, topic): dj_assert_contains(resp_without_interactions, "Ainda não existem dados agregados")
def test_redirect_javascript_url_with_query_string(resp_javascript, redirect_javascript): dj_assert_contains( resp_javascript, f'{redirect_javascript.links.first().url}?utm_source=facebook')
def test_table_instructions(resp, topic): dj_assert_contains(resp, 'Confira os dados consolidados por tópico')
def test_payment_link_is_present(home_resp_open_subscriptions): """ Assert Payment link is present on home page when subscriptions are open """ dj_assert_contains(home_resp_open_subscriptions, reverse('checkout:bootcamp_lp'))
def test_module_table_row(resp, topic: Topic): module = topic.find_module() dj_assert_contains( resp, f'<a href="{module.get_absolute_url()}">{module.title}</a>')
def test_subscription_link_is_present(resp): dj_assert_contains(resp, reverse('payments:waiting_list_ty'))
def test_max_watched_time(resp, interactions: List[TopicInteraction]): max_watched_time = max(interaction.max_watched_time for interaction in interactions) max_watched_time_str = duration(max_watched_time) dj_assert_contains(resp, max_watched_time_str)
def test_module_pythonista_user_can_access(modules_dct, resp_pythonista_user, slug): """ Assert that user with a pythonista role can access the right content """ dj_assert_contains(resp_pythonista_user, modules_dct[slug].get_absolute_url())
def test_interactions_count(resp, interactions: List[TopicInteraction]): interactions_count = len(interactions) dj_assert_contains(resp, f'<td>{interactions_count}</td>')
def test_module_member_user_can_access(modules_dct, resp_member_user, slug): """ Assert that user with a member role can access all the content """ dj_assert_contains(resp_member_user, modules_dct[slug].get_absolute_url())
def test_pending_webinar_msg(resp_video_not_recorded): dj_assert_contains( resp_video_not_recorded, 'Ainda não temos máquina do tempo, esse webinário ainda não foi gravado' )
def test_module_lead_user_can_access(modules_dct, resp_lead_user): """ Assert that user with a lead role can access the right content """ python_birds = modules_dct['python-birds'] dj_assert_contains(resp_lead_user, f'href="{python_birds.get_absolute_url()}"')
def test_module_bootcamper_user_can_access(modules_dct, resp_bootcamper_user, slug): """ Assert that user with a bootcamper role can access the right content """ dj_assert_contains(resp_bootcamper_user, modules_dct[slug].get_absolute_url())
def test_page_content(content, login_get_resp): dj_assert_contains(login_get_resp, content)