def test_award_project_bid(self):
        bid_data = {
            'bid_id': 1,
        }

        self.session.session.put = Mock()
        self.session.session.put.return_value = FakeAwardBidPutResponse()
        award_project_bid(self.session, **bid_data)
        self.session.session.put.assert_called_once_with(
            'https://fake-fln.com/api/projects/0.1/bids/1/',
            headers={'Content-Type': 'application/x-www-form-urlencoded'},
            params={'action': 'award'},
            data=None,
            json=None,
            verify=True)
Exemplo n.º 2
0
def award_bid(bid_id):
    bid_data = {
        'bid_id': bid_id,
    }
    data = None
    try:
        # TODO: Make this an app level attribute instead
        s = Session(oauth_token=h["Freelancer-OAuth-V1"], url=base_url)
        data = award_project_bid(s, **bid_data)
    except BidNotAwardedException as e:
        print('Error message: {}'.format(e.message))
        print('Server response: {}'.format(e.error_code))
        return jsonify(data)
    else:
        return jsonify(data)
def sample_award_project_bid():
    oauth_token = os.environ.get('FLN_OAUTH_TOKEN')
    url = os.environ.get('FLN_URL')
    session = Session(oauth_token=oauth_token, url=url)

    bid_data = {
        'bid_id': 1
    }

    try:
        return award_project_bid(session, **bid_data)
    except BidNotAwardedException as e:
        print(('Error message: %s' % e.message))
        print(('Error code: %s' % e.error_code))
        return None