def test_org_add_post():
    """ Test that we can hack posts in on the fly'"""
    orga = Organization("name", classification="committee")
    orga.add_source(url='foo')
    orga.validate()

    orga.add_post("Human Readable Name", "Chef")

    assert orga._related[0].role == "Chef"
    assert orga._related[0].label == "Human Readable Name"
def test_basic_invalid_organization():
    orga = Organization("name")

    # no source
    with pytest.raises(ValidationError):
        orga.validate()
def test_no_source_on_party_org():
    org = Organization('Hat', classification='party')
    # no source? no problem because classification = party
    org.validate()
def test_basic_organization():
    org = Organization('some org', classification='committee')
    org.add_source('http://example.com')
    assert org.name in str(org)
    org.validate()
def test_no_source_on_party_org():
    org = Organization('Hat', classification='party')
    # no source? no problem because classification = party
    org.validate()
def test_basic_organization():
    org = Organization('some org', classification='committee')
    org.add_source('http://example.com')
    assert org.name in str(org)
    org.validate()
def test_basic_invalid_organization():
    orga = Organization("name")

    # no source
    with pytest.raises(ValidationError):
        orga.validate()