Comments (1)
IMHO, I think this is beyond the scope of this library.
As a wrapper around the library - caching these or performing a GET before the POST creates a possibly complicated state management system. Since update_cases is a POST, it is therefor idempotent and this behavior would go against the spirit of a REST wrapper. You could take it up with testrail/gurock and suggest a non-idempotent PUT for update_run for adding/removing.
You yourself can easily subclass and override the methods (or provide custom methods) around these API calls.
e.g. a local caching implementation
from testrail_api import TestRailAPI
_run_map = {}
class TestRailClient(TestRailAPI):
def update_runs_add(self, run_id, **kwargs):
if _case_ids := _run_map.get(run_id):
case_ids = list(set(kwargs.get('case_ids', []) + _case_ids)))
kwargs['case_ids'] = case_ids
else:
_run_map[run_id] = kwargs.get('case_ids')
return self.runs.update_runs(run_id, **kwargs)
def update_runs_remove(self, run_id, **kwargs):
if _case_ids := _run_map.get(run_id):
case_ids = list(set(_case_ids).difference(kwargs.get('case_ids', [])))
kwargs['case_ids'] = case_ids
else:
raise ValueError("No case Ids to remove from run")
return self.runs.update_runs(run_id, **kwargs)
....
from testrail-api.
Related Issues (20)
- is_completed in _category taking an int instead of bool, pytestrail.py takes bool instead of int HOT 4
- Add ability to pass project_id when requesting list of users
- add warnings.warn about limited write operations using HTTP only
- Custom fields of type 'Multi-select' don't appear in case metadata. HOT 1
- Support for new bulk_api endpoints with pagination HOT 6
- The update_cases method appears incorrect/out-of-date HOT 4
- PYTEST_CURRENT_TEST KeyError during request HOT 1
- feature request: consider custom exceptions for api retry HOT 1
- update_run_in_plan_entry doesn't work
- Add support for Groups API methods
- Add support for Datasets API methods
- Add support for Roles API methods
- Add support for Variables API methods
- Add support for BDD methods
- request: full response object in status code exception
- [update required] update_cases does not accept project_id now in latest APIs, it should be removed HOT 4
- Issue with Plans.add_plan_entry HOT 2
- Runs _session.runs.add_run() for POST index.php?/api/v2/add_run/{project_id} not working as expected HOT 8
- Remove Python 3.7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from testrail-api.