Exemplo n.º 1
0
def test_get_id_item_when_description_not_exits():
    feature = ['Feature:  yeah', '@trello-1234']
    serializer = TrelloCardSerializer()

    result = serializer.get_id_item(feature)

    assert result == '@trello-1234'
Exemplo n.º 2
0
def test_get_name_when_params_is_empty():
    key = ''
    item = ''
    serializer = TrelloCardSerializer()

    with pytest.raises(IndexError):
        serializer.get_name(key, item)
Exemplo n.º 3
0
def test_get_id_from_id_item_when_receive_id_item():
    item = '@trello-1234'
    serializer = TrelloCardSerializer()

    result = serializer.get_id_from_id_item(item)

    assert result == '1234'
Exemplo n.º 4
0
def sync_from_behave_to_trello(client_service, path, board):
    persit_service = PersistUserStoryService()
    card_serializer = TrelloCardSerializer()
    cards = card_serializer.get_user_stories_as_cards(
        persit_service.get_features_from_files(path))
    id_list = client_service.get_id_first_list(board)
    for card in cards:
        push_card(card, id_list, client_service)
Exemplo n.º 5
0
def test_get_file_name_when_receive_params():
    key = 'candy.feature'
    serializer = TrelloCardSerializer()
    expected_result = 'candy'

    result = serializer.get_file_name(key)

    assert result == expected_result
Exemplo n.º 6
0
def test_feature_to_array_when_param_is_empty():
    item = ''
    serializer = TrelloCardSerializer()
    expected_result = []

    result = serializer.feature_to_array(item)

    assert result == expected_result
Exemplo n.º 7
0
def test_get_desc_when_receive_params():
    item = '''\nFeature:  example\n\nSmall description\n\n
        @trello-1234\n\n\n  Scenario:\n\n  Given i like to
        boogie\n\n\n'''
    expected_result = 'Small description\n\n# Scenarios\nGiven i like to \nboogie \n'
    serializer = TrelloCardSerializer()

    result = serializer.get_desc(item)

    assert result == expected_result
Exemplo n.º 8
0
def test_description_exists_is_false_when_description_not_exists():
    serializer = TrelloCardSerializer()
    item = serializer.feature_to_array('''\nFeature:  example\n\n
        @trello-1234\n\n\n  Scenario:\n\n  Given i like to
        boogie\n\n\n''')
    expected_result = False

    result = serializer.description_exists(item)

    assert result == expected_result
Exemplo n.º 9
0
def test_get_name_when_receive_params():
    key = 'candy.feature'
    item = '''\nFeature:  example\n\nSmall description\n\n
        @trello-1234\n\n\n  Scenario:\n\n  Given i like to
        boogie\n\n\n'''
    serializer = TrelloCardSerializer()
    expected_result = '[candy] example'

    result = serializer.get_name(key, item)

    assert result == expected_result
Exemplo n.º 10
0
def test_get_feature_as_card_if_key_item_is_given():
    key = 'candy.feature'
    item = '''\nFeature:  example\n\nSmall description\n\n
        @trello-1234\n\n\n  Scenario:\n\n  Given i like to
        boogie\n\n\n'''
    serializer = TrelloCardSerializer()
    desc = 'Small description\n\n# Scenarios\nGiven i like to \nboogie \n'
    expected_result = {'desc': desc, 'id': '1234', 'name': '[candy] example'}

    result = serializer.get_feature_as_card(key, item)

    assert result == expected_result
Exemplo n.º 11
0
def test_feature_to_array_when_receive_params():
    item = '''\nFeature:  example\n\nSmall description\n\n
        @trello-1234\n\n\n  Scenario:\n\n  Given i like to
        boogie\n\n\n'''
    serializer = TrelloCardSerializer()
    expected_result = ['Feature:  example', 'Small description']
    expected_result.extend(['        @trello-1234', '  Scenario:'])
    expected_result.extend(['  Given i like to', '        boogie'])

    result = serializer.feature_to_array(item)

    assert result == expected_result
Exemplo n.º 12
0
def test_description_exists_raise_exception_when_params_is_empty():
    item = ''
    serializer = TrelloCardSerializer()

    with pytest.raises(IndexError):
        serializer.description_exists(item)
Exemplo n.º 13
0
def test_get_id_from_id_item_when_not_receive_id_item():
    item = ''
    serializer = TrelloCardSerializer()

    with pytest.raises(IndexError):
        serializer.get_id_from_id_item(item)
Exemplo n.º 14
0
def test_get_id_when_params_is_empty():
    item = ''
    serializer = TrelloCardSerializer()

    with pytest.raises(IndexError):
        serializer.get_id(item)
Exemplo n.º 15
0
def test_get_id_item_when_param_is_empty():
    feature = []
    serializer = TrelloCardSerializer()

    with pytest.raises(IndexError):
        serializer.get_id_item(feature)