Package: leantesting
Lean Testing Python SDKPython client for `Lean Testing
API <https://leantesting.com/en/api-docs>`__You can sign up for a Lean Testing account athttps://leantesting.com.RequirementsPython 3.0 or greaterInstallationYou don’t need this source code unless you want to modify the package.
If you just want to use the Lean Testing Python SDK, you should run:pip install --upgrade leantestingoreasy_install --upgrade leantestingSeehttp://www.pip-installer.org/en/latest/index.htmlfor instructions
on installing pip. If you are on a system with easy_install but not
pip, you can use easy_install instead. If you’re not using virtualenv,
you may have to prefix those commands withsudo. You can learn more
about virtualenv athttp://www.virtualenv.org/To install from source, run:python setup.py installUsageIncluding Lean Testing Python SDKfromleantesting.ClientimportClientasLeanTestingClientCreating a new instanceLT=LeanTestingClient()Get CurrentTokenleantesting.getCurrentToken()Attach NewTokenleantesting.attachToken('9ErdKZXpGPnvHuJ9di92eAFqrp14GKvfHMyclGGh')GenerateAuthorization URLgeneratedURL=leantesting.auth.generateAuthLink('DHxaSvtpl91Xos4vb7d0GKkXRu0GJxd5Rdha2HHx','https://www.example.com/appurl/','admin','a3ahdh2iqhdasdasfdjahf26')print(generatedURL)Exchange Authorization Code ForAccess TOKENtoken=leantesting.auth.exchangeAuthCode('DHxaSvtpl91Xos4vb7d0GKkXRu0GJxd5Rdha2HHx','DpOZxNbeL1arVbjUINoA9pOhgS8FNQsOkpE4CtXU','authorization_code','sOgY2DT47B2K0bqashnk0E6wUaYgbbspwdy9kGrk','https://www.example.com/appurl/')print(token)GetUserInformationleantesting.user.getInformation()GetUserOrganizationsleantesting.user.organizations.all().toArray()List AllProjectsleantesting.projects.all().toArray()Create A NewProjectnewProject=leantesting.projects.create({'name':'Project135','organization_id':5779})print(newProject.data)Retrieve An ExistingProjectleantesting.projects.find(3515).dataListProject Sectionsleantesting.projects.find(3515).sections.all().toArray()Adding AProject SectionnewSection=leantesting.projects.find(3515).sections.create({'name':'SectionName'})print(newSection.data)ListProject Versionsleantesting.projects.find(3515).versions.all().toArray()Adding AProject VersionnewVersion=leantesting.projects.find(3515).versions.create({'number':'v0.3.1104'})print(newVersion.data)ListProject Usersleantesting.projects.find(3515).users.all().toArray()ListBug Type Schemeleantesting.projects.find(3515).bugTypeScheme.all().toArray()ListBug Status Schemeleantesting.projects.find(3515).bugStatusScheme.all().toArray()ListBug Severity Schemeleantesting.projects.find(3515).bugSeverityScheme.all().toArray()ListBug Reproducibility Schemeleantesting.projects.find(3515).bugReproducibilityScheme.all().toArray()List AllBugsIn A Projectleantesting.projects.find(3515).bugs.all().toArray()Create A NewBugnewBug=leantesting.projects.find(3515).bugs.create({'title':'Something bad happened...','status_id':1,'severity_id':2,'project_version_id':10242})print(newBug.data)Retrieve ExistingBugleantesting.bugs.find(38483).dataUpdate ABugupdatedBug=leantesting.bugs.update(118622,{'title':'Updated title','status_id':1,'severity_id':2,'project_version_id':10242})print(updatedBug.data)Delete ABugleantesting.bugs.delete(118622)List BugCommentsleantesting.bugs.find(38483).comments.all().toArray()List BugAttachmentsleantesting.bugs.find(38483).attachments.all().toArray()Upload AnAttachmentfilePath='/place/Downloads/Images/1370240743_2294218.jpg'newAttachment=leantesting.bugs.find(38483).attachments.upload(filePath)print(newAttachment.data)Retrieve An ExistingAttachmentleantesting.attachments.find(21515).dataDelete AnAttachmentleantesting.attachments.delete(75258)ListPlatform Typesleantesting.platform.types.all().toArray()RetrievePlatform Typeleantesting.platform.types.find(1).dataListPlatform Devicesleantesting.platform.types.find(1).devices.all().toArray()Retrieve ExistingDeviceleantesting.platform.devices.find(11).dataListOSleantesting.platform.os.all().toArray()Retrieve ExistingOSleantesting.platform.os.find(1).dataListOS Versionsleantesting.platform.os.find(1).versions.all().toArray()ListBrowsersleantesting.platform.browsers.all().toArray()Retrieve ExistingBrowserleantesting.platform.browsers.find(1).dataListBrowser Versionsleantesting.platform.browsers.find(1).versions.all().toArray()UsingFiltersleantesting.projects.find(3515).bugs.all({'limit':2,'page':5}).toArray()Entity ListFunctionsbrowsers=leantesting.platform.browsers.all()print(browsers.total())print(browsers.totalPages())print(browsers.count())print(browsers.toArray())Entity ListIterator When used in for loops, entity lists will
automatically cycle to first page, regardless ofpagefilter.
After ending the loop, the entity list willNOTrevert to first
page or the initial instancingpagefilter setting in order not
to cause useless API request calls.comments=leantesting.bugs.find(38483).comments.all({'limit':1})forpageincomments:print(page)Entity ListManual Iteration ```python comments =
leantesting.bugs.find(38483).comments.all({‘limit’: 1}) print(
comments.toArray() )Will return false if unable to move forwardscomments.next(); print( comments.toArray() )Will return false if already on last pagecomments.last(); print( comments.toArray() )Will return false if unable to move backwardscomments.previous(); print( comments.toArray() )Will return false if already on first pagecomments.first(); print( comments.toArray() ) ```SecurityNeed to report a security vulnerability? Send us an email tosupport@crowdsourcedtesting.comor go directly to our security bug
bounty sitehttps://hackerone.com/leantesting.DevelopmentInstall dependencies:pipinstall-e.TestsInstall dependencies as mentioned above, then you can run the test
suite:python-munittest2discoverContributingPlease seeCONTRIBUTINGfor details.