Comments (7)
Yes, I guess so. It appears that when the unit tests for Casbin access control stuff were written in FOCA, the connections to the database were not mocked. So the tests require a database to be up and running (you can also see that in the GitHub Actions workflow, it uses the mongodb-github-action
).
To make the tests pass locally, I ran the following:
docker run --name mongodb -p 12345:27017 -d mongo:7.0
In my opinion, these are integration tests rather. Unit tests shouldn't have requirements like that. But I guess it's easy enough to fulfull the requirements, so I am not planning on changing it now.
Btw, I guess your fix in #215 worked for you because you probably happened to conincidentally have a MongoDB instance called mongodb
running at port 27017
:)
from foca.
You definitely did my bad! Everything looks good.
from foca.
Can you please tell me where you had the tests failing? The CI pipeline seems to work fine (now that #218 was fixed).
from foca.
Sorry I should have been more descriptive. The test in tests/security/test_cors.py
is the only one that doesn't fail due to server timeouts. Tests in tests/security/access_control/test_access_control_server.py
, tests/security/access_control/test_register_access_control.py
, and tests/security/access_control/foca_casbin_adapter/test_adapter.py
all fail due to timeouts.
If the tests are passing in the pipeline I may be doing something incorrectly. Is there a step missing in the reproduction steps?
from foca.
Anyway, if you can confirm that this works for you (i.e., firing up a MongoDB instance at port 12345), then I think you can close this issue and the accompanying PR :)
from foca.
That makes sense thank you for clearing things up!
Before I close the issue, I think the changes to tests/security/test_cors.py (15ba286) may still be valid. The reason it passes in the pipeline and not in my local environment is that the error only shows up in python 3.12. Even though the test passes in python 3.10, I don't think it's testing the desired functionality (i.e., the assertion is true even though the mock object wasn't called), as described here.
from foca.
Thanks for pointing this out, good catch! 👍 But I think I have already dressed this in b1100bc, when I added support for Py3.12 last night. Can you please check and see if you agree on whether this fix addresses the underlying problem?
from foca.
Related Issues (20)
- build: upgrade pymongo to 4.7.2
- build: upgrade Werkzeug & Flask
- ci: Codecov upload fails
- docs: CI badge broken
- build: drop support for py3.8
- build: add support for Python 3.12
- build: upgrade to Debian 12
- ci: upgrade MongoDB versions
- build: upgrade Pydantic
- chore: replace collection type hints with generics
- build: use Poetry and `pyproject.toml`
- docs: write extensive documentation
- ci: upgrade GitHub Actions
- ci: enforce code style with Black HOT 2
- ci: check code style with Pylint
- ci: check docstrings style with flake8-docstrings
- feat: simplify exceptions handling API HOT 2
- feat(utils): secure "generate_id" function
- flask-auth `2.5.0` dependency cannot be installed in newer versions of pip
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 foca.