fortifyapi/client.py
def upsert(self, project_name, version_name, description="", active=True,
               committed=False, issue_template_id='Prioritized-HighRisk-Project-Template',
               template=DefaultVersionTemplate) -> Version:
        """ same as create but uses existing project and version"""
        # see if the project exists
        # TODO: change this to /projectVersions/action/test with {projectName:x, projectVersionName: y}
        q = Query().query("name", project_name)
        projects = list(self.list(q=q))
        if len(projects) == 0:
            return self.create(project_name, version_name, description=description, active=active, committed=committed,
                               issue_template_id=issue_template_id, template=template)
        else:
            # should be the first one
            project = projects[0]
            # but check if the version is there...
            for v in project.versions.list():
                if v['name'] == version_name:
                    return v
            return self.create(project_name, version_name, project_id=project['id'], description=description, active=active,
                               committed=committed, issue_template_id=issue_template_id, template=template)
 same as create but uses existing project and version
same as create but uses existing project and version
same as create but uses existing project and version
def upsert(self, project_name, version_name, description="", active=True,
               committed=False, issue_template_id='Prioritized-HighRisk-Project-Template',
               template=DefaultVersionTemplate) -> Version:
        q = Query().query("name", project_name)
        projects = list(self.list(q=q))
        if len(projects) == 0:
            return self.create(project_name, version_name, description=description, active=active, committed=committed,
                               issue_template_id=issue_template_id, template=template)
        else:
            project = projects[0]
            for v in project.versions.list():
                if v['name'] == version_name:
                    return v
            return self.create(project_name, version_name, project_id=project['id'], description=description, active=active,
                               committed=committed, issue_template_id=issue_template_id, template=template)
def upsert ( self , project_name , version_name , description = "" , active = True , committed = False , issue_template_id = 'Prioritized-HighRisk-Project-Template' , template = DefaultVersionTemplate ) -> Version : q = Query ( ) . query ( "name" , project_name ) projects = list ( self . list ( q = q ) ) if len ( projects ) == 0 : return self . create ( project_name , version_name , description = description , active = active , committed = committed , issue_template_id = issue_template_id , template = template ) else : project = projects [ 0 ] for v in project . versions . list ( ) : if v [ 'name' ] == version_name : return v return self . create ( project_name , version_name , project_id = project [ 'id' ] , description = description , active = active , committed = committed , issue_template_id = issue_template_id , template = template )
same as create but uses existing project and version
same as create but uses existing project and version
""" same as create but uses existing project and version""" # see if the project exists # TODO: change this to /projectVersions/action/test with {projectName:x, projectVersionName: y} # should be the first one # but check if the version is there...
self
project_name
version_name
description
active
committed
issue_template_id
template