Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
harishmohanraj committed Nov 11, 2024
1 parent a2bad0c commit dea2660
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,18 @@ RUN pip install --upgrade pip && pip install --no-cache-dir -e "."
RUN adduser --disabled-password --gecos '' appuser \
&& chown -R appuser /app \
&& chown -R appuser:appuser /etc/nginx/conf.d /var/log/nginx /var/lib/nginx \
&& touch /run/nginx.pid && chown -R appuser:appuser /run/nginx.pid
&& touch /run/nginx.pid && chown -R appuser:appuser /run/nginx.pid \
# Allow binding to ports > 1024 without root
&& sed -i 's/listen 80/listen 9999/g' /etc/nginx/sites-available/default \
&& sed -i 's/listen \[::\]:80/listen \[::\]:9999/g' /etc/nginx/sites-available/default \
# Create required directories with correct permissions
&& mkdir -p /var/cache/nginx /var/run \
&& chown -R appuser:appuser /var/cache/nginx /var/run

USER appuser

EXPOSE 8000 8008 8888
# ToDo: Fix exposing ports
# EXPOSE 8000 8008 8888

CMD ["/app/run_fastagency.sh"]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ server {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_redirect off;
proxy_buffering off;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,18 @@ RUN pip install --upgrade pip && pip install --no-cache-dir -e "."
RUN adduser --disabled-password --gecos '' appuser \
&& chown -R appuser /app \
&& chown -R appuser:appuser /etc/nginx/conf.d /var/log/nginx /var/lib/nginx \
&& touch /run/nginx.pid && chown -R appuser:appuser /run/nginx.pid
&& touch /run/nginx.pid && chown -R appuser:appuser /run/nginx.pid \
# Allow binding to ports > 1024 without root
&& sed -i 's/listen 80/listen 9999/g' /etc/nginx/sites-available/default \
&& sed -i 's/listen \[::\]:80/listen \[::\]:9999/g' /etc/nginx/sites-available/default \
# Create required directories with correct permissions
&& mkdir -p /var/cache/nginx /var/run \
&& chown -R appuser:appuser /var/cache/nginx /var/run

USER appuser

EXPOSE 8000 8008 8888
# ToDo: Fix exposing ports
# EXPOSE 8000 8008 8888

CMD ["/app/run_fastagency.sh"]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ server {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_redirect off;
proxy_buffering off;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,18 @@ RUN pip install --upgrade pip && pip install --no-cache-dir -e "."
RUN adduser --disabled-password --gecos '' appuser \
&& chown -R appuser /app \
&& chown -R appuser:appuser /etc/nginx/conf.d /var/log/nginx /var/lib/nginx \
&& touch /run/nginx.pid && chown -R appuser:appuser /run/nginx.pid
&& touch /run/nginx.pid && chown -R appuser:appuser /run/nginx.pid \
# Allow binding to ports > 1024 without root
&& sed -i 's/listen 80/listen 9999/g' /etc/nginx/sites-available/default \
&& sed -i 's/listen \[::\]:80/listen \[::\]:9999/g' /etc/nginx/sites-available/default \
# Create required directories with correct permissions
&& mkdir -p /var/cache/nginx /var/run \
&& chown -R appuser:appuser /var/cache/nginx /var/run

USER appuser

EXPOSE 8000 8008 8888
# ToDo: Fix exposing ports
# EXPOSE 8000 8008 8888

CMD ["/app/run_fastagency.sh"]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ server {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_redirect off;
proxy_buffering off;

Expand Down
4 changes: 2 additions & 2 deletions docs/docs_src/user_guide/ui/mesop/main_mesop_basic_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ def simple_workflow(
# TODO: Replace the allowed_users with the desired usernames and hashed passwords
# The hashed passwords can be generated using online tools like https://bcrypt.online
allowed_users={
"[email protected]": "$2y$10$4aH/.C.WritjZAYskA0Dq.htlFDJTa49UuxSVUlp9JCa2K3PgUkaG",
"[email protected]": "$2y$10$Yz9GuF/bWmRFmnXFkauOwePT/U.VSUHdpMOX7GPB8GiklJE4HJZmG"
"[email protected]": "$2y$10$4aH/.C.WritjZAYskA0Dq.htlFDJTa49UuxSVUlp9JCa2K3PgUkaG", # nosemgrep
"[email protected]": "$2y$10$Yz9GuF/bWmRFmnXFkauOwePT/U.VSUHdpMOX7GPB8GiklJE4HJZmG" # nosemgrep
}
)

Expand Down
5 changes: 1 addition & 4 deletions fastagency/ui/mesop/auth/basic_auth/basic_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@ def is_authorized(self, username: str, password: str) -> bool:
return False

password_hash = self.allowed_users[username]
if not self._verify_password(password, password_hash):
return False

return True
return self._verify_password(password, password_hash)

def on_auth_changed(self, e: mel.WebEvent) -> None:
state = me.state(State)

Check warning on line 46 in fastagency/ui/mesop/auth/basic_auth/basic_auth.py

View check run for this annotation

Codecov / codecov/patch

fastagency/ui/mesop/auth/basic_auth/basic_auth.py#L46

Added line #L46 was not covered by tests
Expand Down
1 change: 1 addition & 0 deletions tests/docs_src/test_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# Constants for module paths
MESOP_AUTH_MODULES = {
"docs_src.user_guide.ui.mesop.main_mesop_firebase_auth",
"docs_src.user_guide.ui.mesop.main_mesop_basic_auth",
}

MESOP_NON_AUTH_MODULES = {
Expand Down

0 comments on commit dea2660

Please sign in to comment.