Exemplo n.º 1
0
def should_generate_the_next_action_closing_the_visit():
    test_pages = generators_for_tests.generate_pages_map()
    visit = Visit(visit_duration_seconds=120,
                  app_version='v1',
                  data_anomaly=DataAnomaly.INCONSISTENT_DATA,
                  timer=Timer(-900),
                  keep_private=False)

    json.loads(visit.generate_new_action(test_pages, 130))

    assert_that(visit.is_to_close).is_true()
Exemplo n.º 2
0
def should_generate_invalid_log():
    test_pages = generators_for_tests.generate_pages_map()
    visit = Visit(visit_duration_seconds=120,
                  app_version='v1',
                  data_anomaly=DataAnomaly.MISSING,
                  timer=Timer(-900),
                  keep_private=False)

    invalid_visit_log = json.loads(
        visit.generate_new_action(test_pages, 30, False))

    assert_that(invalid_visit_log['visit_id']).is_none()
Exemplo n.º 3
0
def should_generate_2_different_events_for_the_same_visit_without_anomaly():
    test_pages = generators_for_tests.generate_pages_map()
    visit = Visit(visit_duration_seconds=120,
                  app_version='v1',
                  data_anomaly=DataAnomaly.MISSING,
                  timer=Timer(-900),
                  keep_private=False)

    action_1 = json.loads(visit.generate_new_action(test_pages, 30))
    action_2 = json.loads(visit.generate_new_action(test_pages, 10))

    assertions_for_test.assert_visits_consistency(action_1, action_2)