Skip to content

Add skeleton for backend tests and tests for authentication and swagger doc#27

Merged
rlivings39 merged 7 commits into
mainfrom
ryan-backend-tests
Sep 30, 2025
Merged

Add skeleton for backend tests and tests for authentication and swagger doc#27
rlivings39 merged 7 commits into
mainfrom
ryan-backend-tests

Conversation

@rlivings39
Copy link
Copy Markdown
Member

@rlivings39 rlivings39 commented Sep 24, 2025

This is what I think should be the last step to finish off #2 for user authentication.

I made a few restructuring changes like moving the sqlite setup to a package so I could call it from Python.

Let me know what y'all think!

2 big questions I had

  1. Does the way I'm overriding DB_FILENAME, DB_URL in conftest.py look ok? Any other suggestions?
  2. @hattifnatt4r do you think we should add github actions to the repo to run the backend and frontend tests or will that be too much for the class? Adding it in is pretty easy from a technical perspective and will ensure things don't regress.

Comment thread CONTRIBUTING.md
@RyanSchofield
Copy link
Copy Markdown
Member

I left a few comments, but looks great to me as is!

RyanSchofield
RyanSchofield previously approved these changes Sep 25, 2025
Comment thread server/db_scripts/sqlite_setup.py Outdated
Comment thread server/tests/conftest.py
TEST_DIR = tempfile.TemporaryDirectory()
TEST_DB = os.path.join(TEST_DIR.name, "test.db")
config.sqlite.DB_URL = f"sqlite:///{TEST_DB}"
config.sqlite.DB_FILENAME = TEST_DB
Copy link
Copy Markdown
Member

@RyanSchofield RyanSchofield Sep 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me, or at least I can't see any reason not to do it like this.

Just some random musing: We could have some abstraction around accessing config files. Like a class that would accept argument (or maybe check environment variable?) on init to read from either a prod config, or test config, etc. then have methods for accessing config values. Probably overkill at this point.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm liking this idea of wrapping things in a class/function. Will ponder that and chat w/ Maria today about how she used to use multiple files.

Comment thread server/tests/conftest.py
@hattifnatt4r
Copy link
Copy Markdown
Member

hattifnatt4r commented Sep 25, 2025

  1. Does the way I'm overriding DB_FILENAME, DB_URL in conftest.py look ok? Any other suggestions?

Looks good to me! Another way I can think of is:

  • making a config_example.py file with example values
  • require developers to create config_example.py locally (config.py is ignored by git, so developers can use different setups without conflicts)
  • the scripts use config.py instead of config_example.py

It adds an extra step in the dev setup and server setup (we did this at my previous job), not sure if that's needed for our group.

@hattifnatt4r
Copy link
Copy Markdown
Member

@hattifnatt4r do you think we should add github actions to the repo to run the backend and frontend tests or will that be too much for the class? Adding it in is pretty easy from a technical perspective and will ensure things don't regress.

I think that would be great - but you'll need to teach us how to maintain this setup 🙂

hattifnatt4r
hattifnatt4r previously approved these changes Sep 25, 2025
@rlivings39
Copy link
Copy Markdown
Member Author

@hattifnatt4r added the CI definition for this server that are passing:

https://github.com/cambridge-devclass/ambient-app--react/actions/runs/18110255663/job/51534679207?pr=27

If you're cool with this change, I'd say we merge this and then can discuss if we want to rework how the config is imported.

@hattifnatt4r
Copy link
Copy Markdown
Member

@hattifnatt4r added the CI definition for this server that are passing:

https://github.com/cambridge-devclass/ambient-app--react/actions/runs/18110255663/job/51534679207?pr=27

If you're cool with this change, I'd say we merge this and then can discuss if we want to rework how the config is imported.

Sure that should be good, thank you!

Copy link
Copy Markdown
Member

@hattifnatt4r hattifnatt4r left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thank you!

@rlivings39 rlivings39 merged commit 540a2f4 into main Sep 30, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants