Beispiel #1
0
def test_create_voicemails_same_number_different_contexts():
    number, context = vm_helper.new_number_and_context("vmctx1")
    other_context = vm_helper.new_context("vmctx2")

    response = confd.voicemails.post(name="samenumber1", number=number, context=context)
    response.assert_ok()

    response = confd.voicemails.post(name="samenumber2", number=number, context=other_context)
    response.assert_ok()
Beispiel #2
0
def test_edit_number_and_context_moves_voicemail(voicemail, sysconfd):
    number, context = vm_helper.new_number_and_context('vmctxmove')

    response = confd.voicemails(voicemail['id']).put(number=number,
                                                     context=context)
    response.assert_updated()

    sysconfd.assert_request('/move_voicemail',
                            query={'old_mailbox': voicemail['number'],
                                   'old_context': voicemail['context'],
                                   'new_mailbox': number,
                                   'new_context': context})
Beispiel #3
0
def test_create_voicemails_same_number_different_contexts():
    number, context = vm_helper.new_number_and_context('vmctx1')
    other_context = context_helper.generate_context(name='vmctx2')

    response = confd.voicemails.post(name='samenumber1',
                                     number=number,
                                     context=context)
    response.assert_ok()

    response = confd.voicemails.post(name='samenumber2',
                                     number=number,
                                     context=other_context['name'])
    response.assert_ok()
Beispiel #4
0
def test_edit_number_and_context_moves_voicemail(voicemail, sysconfd):
    number, context = vm_helper.new_number_and_context("vmctxmove")

    response = confd.voicemails(voicemail["id"]).put(number=number, context=context)
    response.assert_ok()

    sysconfd.assert_request(
        "/move_voicemail",
        query={
            "old_mailbox": voicemail["number"],
            "old_context": voicemail["context"],
            "new_mailbox": number,
            "new_context": context,
        },
    )
Beispiel #5
0
def test_edit_voicemail(voicemail):
    number, context = vm_helper.new_number_and_context("vmctxedit")

    parameters = {
        "name": "edited",
        "number": number,
        "context": context,
        "email": "*****@*****.**",
        "pager": "*****@*****.**",
        "language": "en_US",
        "timezone": "eu-fr",
        "password": "******",
        "max_messages": 10,
        "attach_audio": True,
        "ask_password": False,
        "delete_messages": True,
        "enabled": False,
        "options": [["saycid", "yes"], ["emailbody", "this\nis\ra\temail|body"]],
    }

    expected = has_entries(
        {
            "name": "edited",
            "number": number,
            "context": context,
            "email": "*****@*****.**",
            "pager": "*****@*****.**",
            "language": "en_US",
            "timezone": "eu-fr",
            "password": "******",
            "max_messages": 10,
            "attach_audio": True,
            "ask_password": False,
            "delete_messages": True,
            "enabled": False,
            "options": has_items(["saycid", "yes"], ["emailbody", "this\nis\ra\temail|body"]),
        }
    )

    url = confd.voicemails(voicemail["id"])

    response = url.put(parameters)
    response.assert_ok()

    response = url.get()
    assert_that(response.item, expected)
Beispiel #6
0
def test_edit_voicemail(voicemail):
    number, context = vm_helper.new_number_and_context('vmctxedit')

    parameters = {'name': 'edited',
                  'number': number,
                  'context': context,
                  'email': '*****@*****.**',
                  'pager': '*****@*****.**',
                  'language': 'en_US',
                  'timezone': 'eu-fr',
                  'password': '******',
                  'max_messages': 10,
                  'attach_audio': True,
                  'ask_password': False,
                  'delete_messages': True,
                  'enabled': False,
                  'options': [["saycid", "yes"],
                              ["emailbody", "this\nis\ra\temail|body"]]}

    expected = has_entries({'name': 'edited',
                            'number': number,
                            'context': context,
                            'email': '*****@*****.**',
                            'pager': '*****@*****.**',
                            'language': 'en_US',
                            'timezone': 'eu-fr',
                            'password': '******',
                            'max_messages': 10,
                            'attach_audio': True,
                            'ask_password': False,
                            'delete_messages': True,
                            'enabled': False,
                            'options': has_items(["saycid", "yes"],
                                                 ["emailbody", "this\nis\ra\temail|body"])
                            })

    url = confd.voicemails(voicemail['id'])

    response = url.put(parameters)
    response.assert_updated()

    response = url.get()
    assert_that(response.item, expected)