예제 #1
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')
예제 #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')
예제 #3
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")
예제 #4
0
def test_add_action():
    """ Make sure actions work """
    b = toy_bill()
    b.add_action("Some dude liked it.", "2013-04-29", 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-29'
    b.validate()
예제 #5
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()
예제 #6
0
def test_add_action():
    """ Make sure actions work """
    b = toy_bill()
    b.add_action("Some dude liked it.", "2013-04-29", 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-29"
    b.validate()