コード例 #1
0
ファイル: test_app.py プロジェクト: circius/mabd-flask
def test_can_update_delivery_by_id():
    mabd = MABD()
    delivery_id = "recNoBUi8dqEwovSK"

    delivery = mabd.get_record_from_table_by_id("deliveries", delivery_id)

    assert delivery.get_fulfilment() == False
    assert mabd.get_delivery_by_number(3).get_fulfilment() == False

    update_dict = {"fulfilled?": True}

    updated_delivery = mabd.update_delivery(delivery_id, update_dict)

    assert updated_delivery.get_fulfilment() == True
    assert mabd.get_delivery_by_number(3).get_fulfilment() == True
コード例 #2
0
ファイル: test_app.py プロジェクト: circius/mabd-flask
def test_Delivery_prints_itself_nicely(capsys):
    mabd = MABD()
    delivery = mabd.get_delivery_by_number(1)

    print(delivery)
    captured = capsys.readouterr()

    assert "Delivery with" in captured.out
    assert "fulfilled?: True" in captured.out
    assert "number: 1" in captured.out
コード例 #3
0
ファイル: test_api.py プロジェクト: circius/mabd-flask
def test_can_do_delivery_fulfilment(monkeypatch, mock_get_airtable):
    interface = MABD()

    before_fulfilment = interface.get_delivery_by_number(2)
    before_fulfilment_columns = before_fulfilment.get_columns()
    assert "fulfilled?" not in before_fulfilment_columns

    fulfilment = api.do_delivery_fulfilment(2)
    assert type(fulfilment) is Delivery
    fulfilment_columns = fulfilment.get_columns()
    assert "fulfilled?" in fulfilment_columns
    assert fulfilment.get_field("fulfilled?") is True
コード例 #4
0
ファイル: test_app.py プロジェクト: circius/mabd-flask
def test_delivery_get_all_requestIDs_can_handle_deliveries_without_requests():
    mabd = MABD()

    delivery2 = mabd.get_delivery_by_number(2)
    requestIDs = delivery2.get_all_requestIDs()

    assert len(requestIDs) == 2

    delivery2_without_requests = mabd.update_delivery(
        delivery2.get_id(), {"requests": []}
    )

    requestIDs = delivery2_without_requests.get_all_requestIDs()

    assert requestIDs == []
コード例 #5
0
ファイル: test_app.py プロジェクト: circius/mabd-flask
def test_can_get_all_requestIDs_fulfilled_by_delivery():
    mabd = MABD()
    deliveries = mabd.get_airtable("deliveries")
    first_delivery = mabd.get_delivery_by_number(1)
    returned_requests = first_delivery.get_all_requestIDs()
    assert len(returned_requests) == 3