コード例 #1
0
def test_task_when_list_task_a_task_should_have_description():
    TASKS.append({"description": "this is a task"})
    client = TestClient(app)
    response = client.get("/tasks")
    assert "description" in response.json().pop()
    TASKS.clear()
コード例 #2
0
def test_task_when_list_task_a_task_should_have_status():
    TASKS.append({"status": "done"})
    client = TestClient(app)
    response = client.get("/tasks")
    assert "status" in response.json().pop()
コード例 #3
0
def test_when_list_task_a_task_should_have_id():
    TASKS.append({"id": 1})
    client = TestClient(app)
    response = client.get("/tasks")
    assert "id" in response.json().pop()
    TASKS.clear()
コード例 #4
0
def test_when_list_task_a_task_should_have_name():
    TASKS.append({"name": "name one"})
    client = TestClient(app)
    response = client.get("/tasks")
    assert "name" in response.json().pop()
    TASKS.clear()
コード例 #5
0
ファイル: test_manager.py プロジェクト: Serrones/task_manager
def test_when_create_task_its_id_should_be_unique(client, task):
    task_1 = {'title': 'title_1', 'description': 'description_1'}
    response = client.post('/tasks', json=task)
    response_1 = client.post('/tasks', json=task_1)
    assert response.json()['id'] != response_1.json()['id']
    TASKS.clear()
コード例 #6
0
ファイル: test_manager.py プロジェクト: Serrones/task_manager
def test_when_create_task_status_should_be_in_progress(client, task):
    response = client.post('/tasks', json=task)
    assert response.json()['status'] == 'in progress'
    TASKS.clear()
コード例 #7
0
ファイル: test_manager.py プロジェクト: Serrones/task_manager
def test_when_create_task_it_should_be_returned(client, task):
    response = client.post('/tasks', json=task)
    assert response.json()['title'] == task['title']
    assert response.json()['description'] == task['description']
    TASKS.clear()
コード例 #8
0
ファイル: test_manager.py プロジェクト: Serrones/task_manager
def test_when_list_tasks_returned_task_should_have_status():
    TASKS.append({'status': 'done'})
    client = TestClient(app)
    response = client.get('/tasks')
    assert 'status' in response.json().pop()
    TASKS.clear()
コード例 #9
0
ファイル: test_manager.py プロジェクト: Serrones/task_manager
def test_when_list_tasks_returned_task_should_have_description():
    TASKS.append({'description': 'description 1'})
    client = TestClient(app)
    response = client.get('/tasks')
    assert 'description' in response.json().pop()
    TASKS.clear()
コード例 #10
0
ファイル: test_manager.py プロジェクト: Serrones/task_manager
def test_when_list_tasks_returned_task_should_have_title():
    TASKS.append({'title': 'title 1'})
    client = TestClient(app)
    response = client.get('/tasks')
    assert 'title' in response.json().pop()
    TASKS.clear()
コード例 #11
0
ファイル: test_manager.py プロジェクト: Serrones/task_manager
def test_when_create_task_should_be_stored(client, task):
    response = client.post('/tasks', json=task)
    assert response.status_code == 201
    assert len(TASKS) == 1
    TASKS.clear()