def test_create_project(self):
        project_data = {
            'title': 'My new project',
            'description': 'description',
            'currency': create_currency_object(id=1),
            'budget': create_budget_object(minimum=10),
            'jobs': [create_job_object(id=7)],
        }

        self.session.session.post = Mock()
        self.session.session.post.return_value = FakeProjectPostResponse()
        p = create_project(self.session, **project_data)
        self.session.session.post.assert_called_once_with(
            'https://fake-fln.com/api/projects/0.1/projects/',
            json=project_data,
            verify=True)
        self.assertEquals(p.url, 'https://fake-fln.com/projects/java/foo')
    def test_create_project(self):
        project_data = {
            'title': 'My new project',
            'description': 'description',
            'currency': create_currency_object(id=1),
            'budget': create_budget_object(minimum=10),
            'jobs': create_job_object(id=7),
        }

        self.session.session.post = Mock()
        self.session.session.post.return_value = FakeProjectPostResponse()
        p = create_project(self.session, **project_data)
        self.session.session.post.assert_called_once_with(
            'https://fake-fln.com/api/projects/0.1/projects/',
            json=project_data,
            verify=True)
        self.assertEquals(p.url, 'https://fake-fln.com/projects/java/foo')
Exemplo n.º 3
0
    def sample_create_project(self):
        oauth_token = os.environ.get('FLN_OAUTH_TOKEN')
        url = os.environ.get('FLN_URL')
        session = Session(oauth_token=oauth_token, url=url)

        project_data = {
            'title': 'My new project',
            'description': 'description',
            'currency': create_currency_object(id=1),
            'budget': create_budget_object(minimum=10),
            'jobs': [create_job_object(id=7)],
        }

        try:
            p = create_project(session, **project_data)
        except ProjectNotCreatedException as e:
            print(('Error message: %s' % e.message))
            print(('Error code: %s' % e.error_code))
            return None
        else:
            return p
def sample_create_project():
    id = os.environ["FLN_DEVELOPER_ID"]
    token = os.environ["FLN_DEVELOPER_TOKEN"]
    url = os.environ["FLN_URL"]
    session = Session(id=id, token=token, url=url)

    project_data = {
        "title": "My new project",
        "description": "description",
        "currency": create_currency_object(id=1),
        "budget": create_budget_object(minimum=10),
        "jobs": [create_job_object(id=7)],
    }

    try:
        p = create_project(session, **project_data)
    except ProjectNotCreatedException as e:
        print("Error message: %s" % e.message)
        print("Error code: %s" % e.error_code)
        return None
    else:
        return p
def sample_create_project():
    id = os.environ['FLN_DEVELOPER_ID']
    token = os.environ['FLN_DEVELOPER_TOKEN']
    url = os.environ['FLN_URL']
    session = Session(id=id, token=token, url=url)

    project_data = {
        'title': 'My new project',
        'description': 'description',
        'currency': create_currency_object(id=1),
        'budget': create_budget_object(minimum=10),
        'jobs': [create_job_object(id=7)],
    }

    try:
        p = create_project(session, **project_data)
    except ProjectNotCreatedException as e:
        print('Error message: %s' % e.message)
        print('Error code: %s' % e.error_code)
        return None
    else:
        return p