예제 #1
0
  def test_update_short_link(self, mock_upsert_short_link):
    shortlink = ShortLink.get_by_id(115)

    shortlink.destination_url = 'http://sfdc1000.com/%s'

    self.assertEqual('mock_return',
                     helpers.update_short_link(shortlink))

    self.assertEqual(mock_upsert_short_link.call_args_list,
                     [call('1.com', '*****@*****.**', 'sfdc/%s', 'http://sfdc1000.com/%s', shortlink)])
예제 #2
0
def put(link_id):
    existing_link = g.link

    object_data = request.json

    existing_link.destination_url = object_data['destination']

    try:
        return jsonify(
            _get_link_response(helpers.update_short_link(existing_link)))
    except helpers.LinkCreationException as e:
        return jsonify({'error': str(e), 'error_type': 'error_bar'})