示例#1
0
def test_add_action():
    """ Make sure actions work """
    b = toy_bill()
    b.add_action("Some dude liked it.", "2013-04-29T20:00Z", chamber="lower")
    assert len(b.actions) == 1
    assert b.actions[0]["description"] == "Some dude liked it."
    assert get_pseudo_id(b.actions[0]["organization_id"]) == {"classification": "lower"}
    assert b.actions[0]["date"] == "2013-04-29T20:00Z"
    b.validate()
示例#2
0
def test_from_organization():
    # none set
    assert get_pseudo_id(Bill("HB 1", "2014", "Some Bill").from_organization) == {
        "classification": "legislature"
    }

    # chamber set
    assert get_pseudo_id(
        Bill("SB 1", "2014", "Some Bill", chamber="upper").from_organization
    ) == {"classification": "upper"}
    # org direct set
    assert (
        Bill("HB 1", "2014", "Some Bill", from_organization="test").from_organization
        == "test"
    )

    # can't set both
    with pytest.raises(ValueError):
        Bill("HB 1", "2014", "Some Bill", from_organization="upper", chamber="upper")