inventree / inventree-python

Python library for communication with inventree via API
https://docs.inventree.org/en/latest/api/python/python/
MIT License
26 stars 34 forks source link

Add PO ExtraLineItems functionality to API #101

Closed miggland closed 2 years ago

miggland commented 2 years ago

I have copied the relevant functions for PO Line items so that they work for extra line items as well.

These were previously missing from the python API

SchrodingersGat commented 2 years ago

@miggland thanks for this addition. It would be great if you can also add some unit tests for new new class functionality. The existing unit tests should be a pretty good demonstration of how to set that up

miggland commented 2 years ago

OK, I have fixed the style issue and added unit tests according to the template

miggland commented 2 years ago

I realised that the delete method was not working - because of a wrong url, caused by an extra / in the URL. This was copied from the line item, so I changed it there also. I also added tests for deleting line items, as well as extra line items

SchrodingersGat commented 2 years ago

@miggland a couple of things to address here

Style Fixes

A simple change needed here, just read through the suggestions in the "style checks" test

Unit Tests

It appears that the CI unit testing script was not allowing enough time for the InvenTree server to spin up. This has been fixed in #103 . Please merge master into your branch, and re-push, and the tests should run properly then.

miggland commented 2 years ago

I have tried getting the tests to run locally (using invoke test in the inventree-python folder) but have not managed - the server does not come up, but fails at "sqlite3.OperationalError: no such table: label_stockitemlabel".

Anyway, I have fixed the style issues and committed those.

SchrodingersGat commented 2 years ago

I have tried getting the tests to run locally

Did you run the invoke update-image command before running tests? That should get it all setup and ready to run

SchrodingersGat commented 2 years ago

Well, at least the unit tests are running now!

miggland commented 2 years ago

Did you run the invoke update-image command before running tests? That should get it all setup and ready to run

Yes, now I have. And after installing requirements, I had to install coverage as well as pillow because they are not listed in the requirements. The documentation is TESTING.md is a bit lacking here (I'll put a PR for that separately).

New commit coming with fixed tests.