Exemplo n.º 1
0
def test_scenarios_with_special_characters():
    "Make sure that regex special characters in the scenario names are ignored"
    feature = Feature.from_string(FEATURE19)

    assert that(feature.scenarios[0].tags).deep_equals(['runme1'])

    assert that(feature.scenarios[1].tags).deep_equals(['runme2'])
Exemplo n.º 2
0
def test_tempo_should_descrever_quando_difereca_de_tempo_ocorreu_ha_1_hora_e_meia():
    u"TempoRelativo deveria descrever quando difereça de tempo ocorreu ha 1 hora atras"
    relative_time = datetime.now() - timedelta(minutes=90)
    decorrido = TempoRelativo(relative_time)
    assert that(decorrido.ha).equals(u"há 1 hora e meia")
    assert that(decorrido.atras).equals(u"1 hora e 30 minutos atrás")
    assert that(unicode(decorrido)).equals(u"há 1 hora e meia")
Exemplo n.º 3
0
def test_tempo_should_descrever_quando_difereca_de_tempo_ocorreu_ha_pouco_mais_de_1_hora_atras():
    u"TempoRelativo deveria descrever quando difereça de tempo ocorreu ha 1 hora atras"
    relative_time = datetime.now() - timedelta(minutes=61)
    decorrido = TempoRelativo(relative_time)
    assert that(decorrido.ha).equals(u"há pouco mais de 1 hora")
    assert that(decorrido.atras).equals(u"1 hora e 1 minuto atrás")
    assert that(unicode(decorrido)).equals(u"há pouco mais de 1 hora")
Exemplo n.º 4
0
def test_tempo_should_descrever_quando_difereca_de_tempo_ocorreu_ha_menos_de_1_minuto_atras():
    u"TempoRelativo deveria descrever quando difereça de tempo ocorreu ha menos de 1 minuto atras"
    relative_time = datetime.now() - timedelta(seconds=55)
    decorrido = TempoRelativo(relative_time)
    assert that(decorrido.ha).equals(u"há menos de um minuto")
    assert that(decorrido.atras).equals(u"alguns segundos atrás")
    assert that(unicode(decorrido)).equals(u"há menos de um minuto")
def test_single_scenario_many_scenarios():
    "Untagged scenario following a tagged one should have no tags"

    @step('this scenario has tags')
    def scenario_has_tags(step):
        assert step.scenario.tags

    @step('this scenario has no tags')
    def scenario_has_no_tags(step):
        assert not step.scenario.tags

    @step('it can be inspected from within the object')
    def inspected_within_object(step):
        assert step.scenario.tags

    @step(r'fill my email with [\'"]?([^\'"]+)[\'"]?')
    def fill_email(step, email):
        assert that(email).equals('*****@*****.**')

    feature = Feature.from_string(FEATURE13)

    first_scenario = feature.scenarios[0]
    assert that(first_scenario.tags).equals(['runme'])

    second_scenario = feature.scenarios[1]
    assert that(second_scenario.tags).equals([])

    third_scenario = feature.scenarios[2]
    assert that(third_scenario.tags).equals(['slow'])

    last_scenario = feature.scenarios[3]
    assert that(last_scenario.tags).equals([])
Exemplo n.º 6
0
def test_tempo_should_descrever_quando_difereca_de_tempo_ocorreu_ha_1_minuto_e_meio_atras():
    u"TempoRelativo deveria descrever quando difereça de tempo ocorreu ha 1 minuto e meio atras"
    relative_time = datetime.now() - timedelta(seconds=90)
    decorrido = TempoRelativo(relative_time)
    assert that(decorrido.ha).equals(u"há pouco mais de 1 minuto")
    assert that(decorrido.atras).equals(u"1 minuto e 30 segundos atrás")
    assert that(unicode(decorrido)).equals(u"há pouco mais de 1 minuto")
Exemplo n.º 7
0
def test_tempo_should_descrever_quando_difereca_de_tempo_ocorreu_ha_4_horas_atras():
    u"TempoRelativo deveria descrever quando difereça de tempo ocorreu ha 4 horas atras"
    relative_time = datetime.now() - timedelta(minutes=60 * 4)
    decorrido = TempoRelativo(relative_time)
    assert that(decorrido.ha).equals(u"há 4 horas")
    assert that(decorrido.atras).equals(u"4 horas atrás")
    assert that(unicode(decorrido)).equals(u"há 4 horas")
def test_scenarios_with_special_characters():
    "Make sure that regex special characters in the scenario names are ignored"
    feature = Feature.from_string(FEATURE19)

    assert that(feature.scenarios[0].tags).deep_equals([
        'runme1'])

    assert that(feature.scenarios[1].tags).deep_equals([
        'runme2'])
Exemplo n.º 9
0
def test_feature_and_scenario_tags_extraction():
    "Feature tags should be applied to all its scenarios"
    feature = Feature.from_string(FEATURE24)

    assert that(feature.scenarios[0].tags).deep_equals([
        'feature-tag'])

    assert that(feature.scenarios[1].tags).deep_equals([
        'scenario-tag', 'feature-tag'])
Exemplo n.º 10
0
def test_single_feature_single_tag():
    "All scenarios within a feature inherit the feature's tags"
    feature = Feature.from_string(FEATURE18)

    assert that(feature.scenarios[0].tags).deep_equals(
        ['runme1', 'feature_runme'])

    assert that(feature.scenarios[1].tags).deep_equals(
        ['runme2', 'feature_runme'])

    assert that(feature.scenarios[2].tags).deep_equals(
        ['runme3', 'feature_runme'])
Exemplo n.º 11
0
def test_single_feature_single_tag():
    "All scenarios within a feature inherit the feature's tags"
    feature = Feature.from_string(FEATURE18)

    assert that(feature.scenarios[0].tags).deep_equals([
        'runme1', 'feature_runme'])

    assert that(feature.scenarios[1].tags).deep_equals([
        'runme2', 'feature_runme'])

    assert that(feature.scenarios[2].tags).deep_equals([
        'runme3', 'feature_runme'])
Exemplo n.º 12
0
def test_single_feature_single_tag():
    "All scenarios within a feature inherit the feature's tags"
    feature = Feature.from_string(FEATURE18)

    # FIXME (mitgr81):  It seems worth the efficiency to not loop through the feature tags and
    # check to see if every tag exists in the child.  The "right" fix might just be to not
    # add the tag from the feature in the first scenario directly.
    assert that(feature.scenarios[0].tags).deep_equals([
        'feature_runme', 'runme1', 'feature_runme'])

    assert that(feature.scenarios[1].tags).deep_equals([
        'runme2', 'feature_runme'])

    assert that(feature.scenarios[2].tags).deep_equals([
        'runme3', 'feature_runme'])
Exemplo n.º 13
0
def test_feature_first_scenario_tag_extraction():
    ("A feature object should be able to find the single tag "
     "belonging to the first scenario")
    feature = Feature.from_string(FEATURE22)

    assert that(feature.scenarios[0].tags).deep_equals([
        'onetag'])
Exemplo n.º 14
0
def test_feature_first_scenario_tags_extraction():
    ("A feature object should be able to find the tags "
     "belonging to the first scenario")
    feature = Feature.from_string(FEATURE23)

    assert that(feature.scenarios[0].tags).deep_equals([
        'onetag', 'another', '$%^&even-weird_chars'])
Exemplo n.º 15
0
def test_feature_first_scenario_tags_extraction():
    ("A feature object should be able to find the tags "
     "belonging to the first scenario")
    feature = Feature.from_string(FEATURE23)

    assert that(feature.scenarios[0].tags).deep_equals(
        ['onetag', 'another', '$%^&even-weird_chars'])
Exemplo n.º 16
0
def test_single_scenario_many_scenarios():
    "Untagged scenario following a tagged one should have no tags"

    @step('this scenario has tags')
    def scenario_has_tags(step):
        assert step.scenario.tags

    @step('this scenario has no tags')
    def scenario_has_no_tags(step):
        assert not step.scenario.tags

    @step('it can be inspected from within the object')
    def inspected_within_object(step):
        assert step.scenario.tags

    @step(r'fill my email with [\'"]?([^\'"]+)[\'"]?')
    def fill_email(step, email):
        assert that(email).equals('*****@*****.**')

    feature = Feature.from_string(FEATURE13)

    first_scenario = feature.scenarios[0]
    assert that(first_scenario.tags).equals(['runme'])

    second_scenario = feature.scenarios[1]
    assert that(second_scenario.tags).equals([])

    third_scenario = feature.scenarios[2]
    assert that(third_scenario.tags).equals(['slow'])

    last_scenario = feature.scenarios[3]
    assert that(last_scenario.tags).equals([])

    result = feature.run()
    print
    print
    for sr in result.scenario_results:
        for failed in sr.steps_failed:
            print "+" * 10
            print
            print failed.why.cause
            print
            print "+" * 10

    print
    print
    assert result.passed
Exemplo n.º 17
0
def test_single_scenario_single_scenario():
    "Features should have at least the first scenario parsed with tags"
    feature = Feature.from_string(FEATURE11)

    first_scenario = feature.scenarios[0]

    assert that(first_scenario.tags).deep_equals([
        'many', 'other', 'basic', 'tags', 'here', ':)'])
Exemplo n.º 18
0
def test_single_scenario_single_scenario():
    "Features should have at least the first scenario parsed with tags"
    feature = Feature.from_string(FEATURE11)

    first_scenario = feature.scenarios[0]

    assert that(first_scenario.tags).deep_equals(
        ['many', 'other', 'basic', 'tags', 'here', ':)'])
Exemplo n.º 19
0
 def fill_email(step, email):
     assert that(email).equals('*****@*****.**')
Exemplo n.º 20
0
def test_vargas_should_ter_um_numero_de_versao():
    u"vargas deveria ter um numero de versao"
    import vargas
    assert that(vargas.version).equals("0.1")
Exemplo n.º 21
0
def test_feature_first_scenario_tag_extraction():
    ("A feature object should be able to find the single tag "
     "belonging to the first scenario")
    feature = Feature.from_string(FEATURE22)

    assert that(feature.scenarios[0].tags).deep_equals(['onetag'])
Exemplo n.º 22
0
 def fill_email(step, email):
     assert that(email).equals('*****@*****.**')