コード例 #1
0
def test_lista_de_tarefas_nao_vazia_retorna_conteudo():
    tarefas.append({'id': 1, 'titulo': 'tarefa 1',
                    'descricao': 'tarefa de numero 1', 'estado': False})
    app.config['TESTING'] = True
    with app.test_client() as cliente:
        resposta = cliente.get('/tarefas')
        assert resposta.json == [{
            'id': 1,
            'titulo': 'tarefa 1',
            'descricao': 'tarefa de numero 1',
            'estado': False}]
    tarefas.clear()


    
コード例 #2
0
def test_listar_tarefas_deve_retornar_status_200():
    app.config['TESTING'] = True
    with app.test_client() as cliente:
        resposta = cliente.get('/tarefas')
        assert resposta.status_code == 200
コード例 #3
0
def test_listar_tarefas_deve_ter_formato_json():
    app.config['TESTING'] = True
    with app.test_client() as cliente:
        resposta = cliente.get('/tarefas')
        assert resposta.content_type == 'application/json'
コード例 #4
0
def test_lista_de_tarefas_vazia_retorna_lista_vazia():
    app.config['TESTING'] = True
    with app.test_client() as cliente:
        resposta = cliente.get('/tarefas')
        assert resposta.json == []