def test_updates_inbound_number(self, admin_request, mocker):
        inbound_number_id = uuid.uuid4()

        updated_inbound_number = InboundNumber()

        dao_update_inbound_number = mocker.patch(
            'app.inbound_number.rest.dao_update_inbound_number',
            return_value=updated_inbound_number
        )

        update_dictionary = {
            'number': 'some-number',
            'provider': 'some-provider',
            'service_id': 'some-service-id'
        }
        response = admin_request.post(
            'inbound_number.update_inbound_number',
            _data=update_dictionary,
            _expected_status=200,
            inbound_number_id=inbound_number_id
        )

        dao_update_inbound_number.assert_called_with(inbound_number_id, **update_dictionary)

        assert response['data'] == updated_inbound_number.serialize()
    def test_returns_inbound_numbers(self, admin_request, mocker):
        inbound_number = InboundNumber()
        mocker.patch('app.inbound_number.rest.dao_get_inbound_numbers', return_value=[inbound_number])

        result = admin_request.get('inbound_number.get_inbound_numbers')

        assert result['data'] == [inbound_number.serialize()]
def create_inbound_number():
    data = request.get_json()

    validate(data, post_create_inbound_number_schema)

    inbound_number = InboundNumber(**data)
    dao_create_inbound_number(inbound_number)
    return jsonify(data=inbound_number.serialize()), 201
    def test_gets_inbound_numbers(self, admin_request, mocker):
        inbound_number = InboundNumber()
        mocker.patch(
            'app.inbound_number.rest.dao_get_inbound_numbers_for_service',
            return_value=[inbound_number]
        )

        result = admin_request.get(
            'inbound_number.get_inbound_numbers_for_service',
            service_id=uuid.uuid4()
        )

        assert result['data'] == [inbound_number.serialize()]