def test_invalid_contact_list_id(self):
        """
        When the contact list ID cannot be cast to an integer, the error
        is allowed to propagate.

        """
        with MockPortalConnection() as connection:
            with assert_raises(ValueError):
                invalid_contact_list_id = 'not an integer'
                delete_contact_list(invalid_contact_list_id, connection)
Exemple #2
0
    def test_invalid_contact_list_id(self):
        """
        When the contact list ID cannot be cast to an integer, the error
        is allowed to propagate.

        """
        with MockPortalConnection() as connection:
            with assert_raises(ValueError):
                invalid_contact_list_id = 'not an integer'
                delete_contact_list(invalid_contact_list_id, connection)
    def test_valid_contact_list_id(self):
        """
        It must be possible to cast the ID of the contact list to an integer,
        since these are the only valid types of ID.

        """
        valid_contact_list_id = '123'
        simulator = DeleteContactList(valid_contact_list_id)
        with MockPortalConnection(simulator) as connection:
            delete_contact_list(valid_contact_list_id, connection)
Exemple #4
0
    def test_valid_contact_list_id(self):
        """
        It must be possible to cast the ID of the contact list to an integer,
        since these are the only valid types of ID.

        """
        valid_contact_list_id = '123'
        simulator = DeleteContactList(valid_contact_list_id)
        with MockPortalConnection(simulator) as connection:
            delete_contact_list(valid_contact_list_id, connection)
def test_static_lists():
    with _get_portal_connection() as connection:
        new_contact_list_name = 'contactlisttest'
        created_static_list = \
            create_static_contact_list(new_contact_list_name, connection)
        eq_(new_contact_list_name, created_static_list.name)

        all_contact_lists = get_all_contact_lists(connection)
        assert_in(created_static_list, all_contact_lists)

        all_contacts = get_all_contacts(connection)
        first_contact = next(all_contacts)
        added_contact_vids = add_contacts_to_list(
            created_static_list,
            [first_contact],
            connection,
            )
        assert_in(first_contact.vid, added_contact_vids)

        contacts_in_list = list(
            get_all_contacts_from_list(connection, created_static_list)
            )
        assert_in(first_contact, contacts_in_list)

        removed_contact_vids = remove_contacts_from_list(
            created_static_list,
            [first_contact],
            connection,
            )
        assert_in(first_contact.vid, removed_contact_vids)

        contacts_in_list = list(
            get_all_contacts_from_list(connection, created_static_list)
            )
        assert_not_in(first_contact, contacts_in_list)

        delete_contact_list(created_static_list.id, connection)

        all_contact_lists = get_all_contact_lists(connection)
        assert_not_in(created_static_list, all_contact_lists)
Exemple #6
0
def test_static_lists():
    with _get_portal_connection() as connection:
        new_contact_list_name = 'contactlisttest'
        created_static_list = \
            create_static_contact_list(new_contact_list_name, connection)
        eq_(new_contact_list_name, created_static_list.name)

        all_contact_lists = get_all_contact_lists(connection)
        assert_in(created_static_list, all_contact_lists)

        all_contacts = get_all_contacts(connection)
        first_contact = next(all_contacts)
        added_contact_vids = add_contacts_to_list(
            created_static_list,
            [first_contact],
            connection,
        )
        assert_in(first_contact.vid, added_contact_vids)

        contacts_in_list = list(
            get_all_contacts_from_list(connection, created_static_list)
        )
        assert_in(first_contact, contacts_in_list)

        removed_contact_vids = remove_contacts_from_list(
            created_static_list,
            [first_contact],
            connection,
        )
        assert_in(first_contact.vid, removed_contact_vids)

        contacts_in_list = list(
            get_all_contacts_from_list(connection, created_static_list)
        )
        assert_not_in(first_contact, contacts_in_list)

        delete_contact_list(created_static_list.id, connection)

        all_contact_lists = get_all_contact_lists(connection)
        assert_not_in(created_static_list, all_contact_lists)
 def test_successful_deletion(self):
     simulator = DeleteContactList(_STUB_CONTACT_LIST.id)
     with MockPortalConnection(simulator) as connection:
         delete_contact_list(_STUB_CONTACT_LIST.id, connection)
Exemple #8
0
 def test_successful_deletion(self):
     simulator = DeleteContactList(_STUB_CONTACT_LIST.id)
     with MockPortalConnection(simulator) as connection:
         delete_contact_list(_STUB_CONTACT_LIST.id, connection)