def test_updates_service_id(self, existing_inbound_number):
        new_service_id = create_service(service_name="new service").id
        dao_update_inbound_number(existing_inbound_number.id,
                                  service_id=new_service_id)

        assert InboundNumber.query.get(
            existing_inbound_number.id).service_id == new_service_id
コード例 #2
0
def update_inbound_number(inbound_number_id):
    data = request.get_json()

    validate(data, post_update_inbound_number_schema)

    inbound_number = dao_update_inbound_number(inbound_number_id, **data)
    return jsonify(data=inbound_number.serialize()), 200
    def test_updates_provider(self, existing_inbound_number):
        dao_update_inbound_number(existing_inbound_number.id,
                                  provider='new-provider')

        assert InboundNumber.query.get(
            existing_inbound_number.id).provider == 'new-provider'
 def test_returns_updated_inbound_number(self, existing_inbound_number):
     updated = dao_update_inbound_number(existing_inbound_number.id,
                                         number='new-number')
     assert updated.number == 'new-number'
 def test_does_not_update_unknown_attribute(self, existing_inbound_number):
     with pytest.raises(Exception):
         dao_update_inbound_number(
             existing_inbound_number.id,
             some_attribute_that_does_not_exist='value')
    def test_updates_active(self, existing_inbound_number):
        dao_update_inbound_number(existing_inbound_number.id, active=False)

        assert not InboundNumber.query.get(existing_inbound_number.id).active