def test_full_organization():
    create_jurisdictions()
    org = ScrapeOrganization("United Nations", classification="international")
    org.add_identifier("un")
    org.add_name("UN", start_date="1945")
    org.add_contact_detail(type="phone",
                           value="555-555-1234",
                           note="this is fake")
    org.add_link("http://example.com/link")
    org.add_source("http://example.com/source")

    # import org
    od = org.as_dict()
    OrganizationImporter("jid1").import_data([od])

    # get person from db and assert it imported correctly
    o = Organization.objects.get()
    assert "ocd-organization" in o.id
    assert o.name == org.name

    assert o.identifiers.all()[0].identifier == "un"
    assert o.identifiers.all()[0].scheme == ""

    assert o.other_names.all()[0].name == "UN"
    assert o.other_names.all()[0].start_date == "1945"

    assert o.contact_details.all()[0].type == "phone"
    assert o.contact_details.all()[0].value == "555-555-1234"
    assert o.contact_details.all()[0].note == "this is fake"

    assert o.links.all()[0].url == "http://example.com/link"
    assert o.sources.all()[0].url == "http://example.com/source"
    def scrape(self, session=None):
        if session is None:
            session = self.latest_session()
            self.info("no session specified, using %s", session)

        # com_types = ['J', 'SE', 'O']
        # base_url = 'https://wyoleg.gov/LsoService/api/committeeList/2018/J'
        url = "https://wyoleg.gov/LsoService/api/committees/{}".format(session)

        response = self.get(url)
        coms_json = json.loads(response.content.decode("utf-8"))

        for row in coms_json:
            com_url = "https://wyoleg.gov/LsoService/api/committeeDetail/{}/{}".format(
                session, row["ownerID"])
            com_response = self.get(com_url)
            com = json.loads(com_response.content.decode("utf-8"))

            # WY doesn't seem to have any house/senate only committees that I can find
            committee = Organization(name=com["commName"],
                                     chamber="legislature",
                                     classification="committee")

            for member in com["commMembers"]:
                role = "chairman" if member[
                    "chairman"] == "Chairman" else "member"
                committee.add_member(member["name"], role)

            # some WY committees have non-legislators appointed to the member by the Governor
            # but the formatting is super inconsistent
            if com["otherMembers"]:
                committee.extras["other_members"] = com["otherMembers"]

            committee.extras["wy_id"] = com["commID"]
            committee.extras["wy_code"] = com["ownerID"]
            committee.extras["wy_type_code"] = com["type"]
            committee.extras["budget"] = com["budget"]

            if com["statAuthority"]:
                committee.extras["statutory_authority"] = com["statAuthority"]

            if com["number"]:
                committee.extras["seat_distribution"] = com["number"]

            committee.add_identifier(scheme="WY Committee ID",
                                     identifier=str(com["commID"]))
            committee.add_identifier(scheme="WY Committee Code",
                                     identifier=str(com["ownerID"]))

            if com["description"]:
                committee.add_identifier(scheme="Common Name",
                                         identifier=com["description"])

            source_url = "http://wyoleg.gov/Committees/{}/{}".format(
                session, com["ownerID"])
            committee.add_source(source_url)

            yield committee