def test_place_project_bid(self):
        bid_data = {
            'project_id': 1,
            'bidder_id': 2,
            'amount': 10,
            'period': 2,
            'milestone_percentage': 100,
            'description': 'A bid',
        }

        self.session.session.post = Mock()
        self.session.session.post.return_value = FakePlaceBidPostResponse()
        b = place_project_bid(self.session, **bid_data)
        self.session.session.post.assert_called_once_with(
            'https://fake-fln.com/api/projects/0.1/bids/',
            json=bid_data,
            verify=True)
        self.assertTrue(getattr(b, 'bidder_id'))
        self.assertTrue(getattr(b, 'description'))
    def test_place_project_bid(self):
        bid_data = {
            'project_id': 1,
            'bidder_id': 2,
            'amount': 10,
            'period': 2,
            'milestone_percentage': 100,
            'description': 'A bid',
        }

        self.session.session.post = Mock()
        self.session.session.post.return_value = FakePlaceBidPostResponse()
        b = place_project_bid(self.session, **bid_data)
        self.session.session.post.assert_called_once_with(
            'https://fake-fln.com/api/projects/0.1/bids/',
            json=bid_data,
            verify=True)
        self.assertTrue(getattr(b, 'bidder_id'))
        self.assertTrue(getattr(b, 'description'))
Example #3
0
def sample_place_project_bid():

    url = os.environ.get('FLN_URL')
    oauth_token = os.environ.get('FLN_OAUTH_TOKEN')
    project_id = os.environ.get('PROJECT_ID')

    session = Session(oauth_token=oauth_token, url=url)
    my_user_id = get_self_user_id(session)
    bid_data = {
        'project_id': int(project_id),
        'bidder_id': my_user_id,
        'amount': 10,
        'period': 2,
        'milestone_percentage': 100,
        'description': 'This is my bid',
    }
    try:
        return place_project_bid(session, **bid_data)
    except BidNotPlacedException as e:
        print(('Error message: %s' % e.message))
        print(('Error code: %s' % e.error_code))
        return None
def sample_place_project_bid():

    url = os.environ['FLN_URL']
    id = os.environ['FLN_DEVELOPER_ID']
    token = os.environ['FLN_DEVELOPER_TOKEN']
    project_id = os.environ['PROJECT_ID']

    session = Session(id=id, token=token, url=url)
    my_user_id = get_self_user_id(session)
    bid_data = {
        'project_id': int(project_id),
        'bidder_id': my_user_id,
        'amount': 10,
        'period': 2,
        'milestone_percentage': 100,
        'description': 'This is my bid',
    }
    try:
        return place_project_bid(session, **bid_data)
    except BidNotPlacedException as e:
        print('Error message: %s' % e.message)
        print('Error code: %s' % e.error_code)
        return None