Commit Graph

211 Commits

Author SHA1 Message Date
Matthias Mair
e83995b4f5
Add bleach (#41) (#3204)
* use shims for API view inheritation

* Add mixin for input sanitation

* fix clean operation to fix all string values

* Also clean up dicts
this is to future-proof this function

* Update docstirng

* proof custom methods against XSS through authenticated users
2022-06-16 10:01:53 +10:00
Oliver
403655e3d2
Adding bulk deletion endpoint for notifications (#3154)
* Catch DoesNotExist error

* Move notificationtable function to js file

* Fix for custom metadata class

- Previously only worked if a POST or PUT action was available on the endpoint
- So, a ListAPIView endpoint would not actually work!
- Adding in a BulkDelete mixin to a ListAPIView caused failure

* Add unit test to ensure new OPTIONS metadata updates are checked

* Expand functionality of the existing BulkDelete mixin

- Allow deletion by custom filters
- Allow each implementing class to implement custom filters
- Adds more unit testing for BulkDelete mixin class

* Add bulk delete operation for Notification API

- Ensure users can only delete their *own* notifications

* Improve notification tables / buttons / etc

* Adds unit testing for bulk delete of notifications

- Fixed API permissions for notifications list endpoint

* Update BulkDelete operations for the StockItemTestResult table

* Use filters parameter in attachments table to ensure that only correct attachments are deleted

* JS linting

* Fixes for unit tests
2022-06-08 07:45:30 +10:00
Oliver
a066fcc909
Add new global setting to control auto-upload of test reports (#3137)
* Add new global setting to control auto-upload of test reports

* Adds callback to attach a copy of the test report when printing

* Fix for all attachment API endpoints

- The AttachmentMixin must come first!
- User was not being set, as the custom 'perform_create' function was never called

* Remove duplicated UserSerializer

* display uploading user in attachment table

* Add unit test to check the test report is automatically uploaded
2022-06-06 15:20:41 +10:00
Matthias Mair
f38386b13c
Add more checks to pre-commit (#3132)
* Add bandit to pre-commit checks

* fix catchall exceptions

* remove unused definitons

* remove unuseed ariables

* Add docstring

* fix B006, B008 errors

* fix B007 error

* ignore B009

* Add checks for formatting and naming
2022-06-06 08:56:52 +10:00
Matthias Mair
0c97a50e47
Docstring checks in QC checks (#3089)
* Add pre-commit to the stack

* exclude static

* Add locales to excludes

* fix style errors

* rename pipeline steps

* also wait on precommit

* make template matching simpler

* Use the same code for python setup everywhere

* use step and cache for python setup

* move regular settings up into general envs

* just use full update

* Use invoke instead of static references

* make setup actions more similar

* use python3

* refactor names to be similar

* fix runner version

* fix references

* remove incidential change

* use matrix for os

* Github can't do this right now

* ignore docstyle errors

* Add seperate docstring test

* update flake call

* do not fail on docstring

* refactor setup into workflow

* update reference

* switch to action

* resturcture

* add bash statements

* remove os from cache

* update input checks

* make code cleaner

* fix boolean

* no relative paths

* install wheel by python

* switch to install

* revert back to simple wheel

* refactor import export tests

* move setup keys back to not disturbe tests

* remove docstyle till that is fixed

* update references

* continue on error

* add docstring test

* use relativ action references

* Change step / job docstrings

* update to merge

* reformat comments 1

* fix docstrings 2

* fix docstrings 3

* fix docstrings 4

* fix docstrings 5

* fix docstrings 6

* fix docstrings 7

* fix docstrings 8

* fix docstirns 9

* fix docstrings 10

* docstring adjustments

* update the remaining docstrings

* small docstring changes

* fix function name

* update support files for docstrings

* Add missing args to docstrings

* Remove outdated function

* Add docstrings for the 'build' app

* Make API code cleaner

* add more docstrings for plugin app

* Remove dead code for plugin settings
No idea what that was even intended for

* ignore __init__ files for docstrings

* More docstrings

* Update docstrings for the 'part' directory

* Fixes for related_part functionality

* Fix removed stuff from merge 99676ee

* make more consistent

* Show statistics for docstrings

* add more docstrings

* move specific register statements to make them clearer to understant

* More docstrings for common

* and more docstrings

* and more

* simpler call

* docstrings for notifications

* docstrings for common/tests

* Add docs for common/models

* Revert "move specific register statements to make them clearer to understant"

This reverts commit ca96654622.

* use typing here

* Revert "Make API code cleaner"

This reverts commit 24fb68bd3e.

* docstring updates for the 'users' app

* Add generic Meta info to simple Meta classes

* remove unneeded unique_together statements

* More simple metas

* Remove unnecessary format specifier

* Remove extra json format specifiers

* Add docstrings for the 'plugin' app

* Docstrings for the 'label' app

* Add missing docstrings for the 'report' app

* Fix build test regression

* Fix top-level files

* docstrings for InvenTree/InvenTree

* reduce unneeded code

* add docstrings

* and more docstrings

* more docstrings

* more docstrings for stock

* more docstrings

* docstrings for order/views

* Docstrings for various files in the 'order' app

* Docstrings for order/test_api.py

* Docstrings for order/serializers.py

* Docstrings for order/admin.py

* More docstrings for the order app

* Add docstrings for the 'company' app

* Add unit tests for rebuilding the reference fields

* Prune out some more dead code

* remove more dead code

Co-authored-by: Oliver Walters <oliver.henry.walters@gmail.com>
2022-06-02 01:37:39 +10:00
Matthias Mair
6247eecf69
Exclude testing exceptions from coverage (#3046)
* exclude testing excetions

* check user str

* check related users

* move no coverage marker

* fix assertation

* add test for filters

* do not cover logs
2022-05-22 15:54:13 +10:00
Matthias Mair
5805685c48 Merge branch 'master' of https://github.com/inventree/InvenTree into style-fixes 2022-05-21 23:57:41 +02:00
Matthias Mair
b7a501f42c log out first 2022-05-20 19:09:51 +02:00
Matthias Mair
e1d22f538d resort imports 2022-05-20 17:24:51 +02:00
Matthias Mair
9f922f06ff fix more imports 2022-05-20 12:53:04 +02:00
Matthias Mair
e8287f02d4 rename 2022-05-20 12:33:51 +02:00
Matthias Mair
0d5dea3e6d refactor test setup 2022-05-20 12:12:32 +02:00
Jakob Haufe
a373e669cd
Add permission 2022-05-18 13:24:58 +02:00
Oliver
9bcbaaa5f5 Remove more python2 stuff 2022-05-17 16:57:31 +10:00
Matthias
3712daca55
remove duplicate code
we are already checking this stuff from line 640
2022-05-13 01:27:40 +02:00
Matthias Mair
cf93ba7cf9
Merge branch 'inventree:master' into matmair/issue2385 2022-05-04 12:23:05 +02:00
Matthias
07a86a3883
ognore catches in coverage 2022-05-03 22:05:56 +02:00
Matthias
300558adb0
increase coverage on owners model 2022-05-03 20:26:49 +02:00
Matthias Mair
4125803e6d
Merge branch 'inventree:master' into matmair/issue2385 2022-05-02 21:50:52 +02:00
Matthias
de6507e918
update translation commands 2022-05-01 22:03:49 +02:00
Matthias
67ab45bdee
update depreciated paths 2022-05-01 22:00:18 +02:00
Matthias
7063db7a32
add missing model ruleset 2022-04-05 00:43:29 +02:00
Matthias
bff2fb81f3
rename AdditionalLineItems to ExtraLine 2022-03-27 01:11:25 +01:00
Matthias Mair
ce68ee3781
Merge branch 'inventree:master' into matmair/issue2694 2022-03-20 22:15:27 +01:00
Matthias Mair
966eb60dd8
Merge branch 'inventree:master' into matmair/issue2694 2022-03-16 15:16:07 +01:00
Matthias Mair
1e57bdcfba
Merge branch 'inventree:master' into matmair/issue2279 2022-03-16 15:15:46 +01:00
Matthias
33d9913f78
do not cover programming error 2022-03-13 21:11:22 +01:00
Matthias
1e4727d733
ignore precaution for plugin programmers srewing up in coverage 2022-03-13 19:48:49 +01:00
Matthias
e68cc25294
ignore programming error in coverage 2022-03-13 19:48:04 +01:00
Matthias
4eaa655a7c
ignore for coverage 2022-03-12 03:43:04 +01:00
Matthias
56ebb0fd0e
ignore custom admin form 2022-03-12 03:40:50 +01:00
Matthias
d8fc56cf61
ignore m2m for coverage 2022-03-12 03:40:27 +01:00
Matthias
c6383e9f7e
add user ruleset 2022-03-11 00:59:07 +01:00
Matthias
b81d2b8410
cut back on modifications 2022-03-05 23:10:20 +01:00
Matthias Mair
86ba69eeaf
Merge branch 'inventree:master' into matmair/issue2279 2022-02-28 00:45:58 +01:00
Oliver
fe4d063135 Change some prints to log messages 2022-02-25 17:19:39 +11:00
Matthias Mair
626f44d195
Merge branch 'inventree:master' into matmair/issue2279 2022-02-16 02:02:02 +01:00
Matthias
238cc9e278
disable broken test 2022-02-14 00:42:47 +01:00
Matthias
8df5a3f980
add more user api tests 2022-02-14 00:21:15 +01:00
Matthias
6848787885
remove dead code -> permission class does that already 2022-02-14 00:21:01 +01:00
Matthias
a4d94f31c8
add test for non existing token 2022-02-14 00:14:11 +01:00
Matthias
9246eea38e
PEP fix 2022-02-13 23:42:05 +01:00
Matthias
384d458110
user api tests 2022-02-13 23:39:10 +01:00
Matthias
e262599d83
ignore unreachable things 2022-02-13 23:32:55 +01:00
Matthias
ffafc20c6d
do not count unreachable code 2022-02-13 23:30:27 +01:00
Matthias
898f99c931
ignore not testable condition 2022-02-13 17:42:50 +01:00
Matthias
127368d47f
ignore coverage on ruleset checks 2022-02-13 05:04:51 +01:00
Matthias
9eb238c85e
Merge branch 'master' of https://github.com/inventree/InvenTree into matmair/issue2279 2022-02-12 00:51:15 +01:00
eeintech
3b45c1406a Improved approach to permission check at runtime 2022-02-07 15:42:39 -05:00
eeintech
fd63fcde43 Reverted print statement to logger 2022-02-07 15:39:06 -05:00