def test_get_multiple_users_associated_to_voicemail(user1, user2, voicemail): expected = has_items( has_entries({ 'user_id': user1['id'], 'voicemail_id': voicemail['id'] }), has_entries({ 'user_id': user2['id'], 'voicemail_id': voicemail['id'] })) with a.user_voicemail(user1, voicemail), a.user_voicemail(user2, voicemail): response = confd.voicemails(voicemail['id']).users.get() assert_that(response.items, expected)
def test_get_user_voicemail_association(user, voicemail): expected = has_entries({ 'user_id': user['id'], 'voicemail_id': voicemail['id'] }) with a.user_voicemail(user, voicemail): response = confd.users(user['id']).voicemail.get() assert_that(response.item, expected) response = confd.users(user['uuid']).voicemail.get() assert_that(response.item, expected)
def test_given_user_has_voicemail_when_exporting_then_csv_has_voicemail_fields( user, voicemail): expected = has_entries(uuid=user['uuid'], voicemail_name="Jàmie", voicemail_number=voicemail['number'], voicemail_context=voicemail['context'], voicemail_password="******", voicemail_email="*****@*****.**", voicemail_attach_audio="1", voicemail_delete_messages="1", voicemail_ask_password="******") with a.user_voicemail(user, voicemail): response = confd_csv.users.export.get() assert_that(response.csv(), has_item(expected))
def test_associate_when_already_associated(user, voicemail): with a.user_voicemail(user, voicemail): response = confd.users( user['id']).voicemail.post(voicemail_id=voicemail['id']) response.assert_match(400, e.resource_associated('User', 'Voicemail'))
def test_edit_voicemail_when_still_associated(user, voicemail): number = h.voicemail.find_available_number(voicemail['context']) with a.user_voicemail(user, voicemail): response = confd.voicemails(voicemail['id']).put(number=number) response.assert_updated()
def test_delete_voicemail_when_still_associated(user, voicemail): with a.user_voicemail(user, voicemail): response = confd.voicemails(voicemail['id']).delete() response.assert_match(400, e.resource_associated('Voicemail', 'User'))
def test_dissociate_using_uuid(user, voicemail): with a.user_voicemail(user, voicemail, check=False): response = confd.users(user['uuid']).voicemail.delete() response.assert_deleted()