hotosm / fmtm

Field Mapping Tasking Manager - coordinated field mapping.
https://fmtm.hotosm.org/
GNU Affero General Public License v3.0
49 stars 46 forks source link

Add tests for submission routes #1917

Closed Anuj-Gupta4 closed 1 day ago

Anuj-Gupta4 commented 3 days ago

What type of PR is this? (check all applicable)

Related Issue

Example: Resolves #1913

Describe this PR

A fixture for submission has been created and some tests have been added for submission routes.

Checklist before requesting a review

Anuj-Gupta4 commented 3 days ago

@spwoodcock Should I add more tests for submission routes?

I wonder if i should simply make another api call to replace the basic auth with session authentication using: https://docs.getodk.org/central-api-authentication/#using-the-session

spwoodcock commented 3 days ago

No need for that if this approach works 😄

I think it would be more valuable adding pyodk as a dependency in FMTM, as it might be useful elsewhere anyway:

uv add pyodk

The submission could be created with the pyodk client, then more tests written for json CSV and geojson downloads =)

I'll leave you to assess how much time this may take though and if it's worth it. Requirements relates to Tokha could be addressed instead if this will take a long time 👍 Either way is fine!

Anuj-Gupta4 commented 2 days ago

I haven't included the .pyodk_config.toml file in tests directory.

spwoodcock commented 1 day ago

As the credentials are only used for testing, it's ok to commit that file. I think we need it for the tests to work (pyodk doesn't accept environment variables unfortunately 🥲)

spwoodcock commented 1 day ago

Sorry Anuj! I didn't mean the dev server credentials!

The credentials you can use are for the locally installed version of ODK Central, which always has user admin@hotosm.org and password Password1234. The URL is https://proxy (which resolves to the proxy container, and then forwards traffic to the ODK Central container over HTTPS)

Anuj-Gupta4 commented 1 day ago

Oops my bad.