Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unit tests for STAC transactions #413

Open
1 task done
slesaad opened this issue Aug 5, 2024 · 5 comments
Open
1 task done

Fix unit tests for STAC transactions #413

slesaad opened this issue Aug 5, 2024 · 5 comments
Assignees

Comments

@slesaad
Copy link
Member

slesaad commented Aug 5, 2024

Description

In the transactions PR, we added some unit tests, but had some trouble getting them to work.

So for now we've commented out the tests in the CICD.

Fix the tests and uncomment the lines in the workflow.

AC

  • Transactions unit tests running well in the GitHub PR action
slesaad added a commit that referenced this issue Aug 6, 2024
### Issue

#295

### What?

- Add transactions extensions from -
#276
- Add bulk transactions extension
- Add authentication for all transactions PUT POST endpoints
- Add authentication to openapi docs
- Add request validation to all all transactions PUT POST endpoints

### Why?

- To allow stac editing (collection and item) + enable stac-admin

### Testing?

- Tested locally as well as deployed to
https://stacadmin.openveda.cloud/api/stac/docs

### TODO
- [x] Refactor the way env vars are used
- [x] Remove temporary workflow
- [x] Fix failing tests
- [x] Use `pystac` instead of `stac_pydantic`
- [x] Make transactions a feature flag
- [x] Package auth?
~~- [ ] Tests~~ (to be handled in [a separate
ticket](#413))
@smohiudd
Copy link
Contributor

smohiudd commented Aug 6, 2024

@slesaad @stephenkilbourn was the short term fix to include endpoint tests in this PR with the workflows tests for stac and raster: https://github.com/NASA-IMPACT/veda-backend/pull/397/files?

@stephenkilbourn
Copy link
Contributor

@smohiudd - I believe we can review and merge in that PR (#397 ) , and then follow up with a third PR for the transaction tests to keep PRs a little smaller and easier to read. I'll tie that new PR to this issue number.

@smohiudd
Copy link
Contributor

smohiudd commented Aug 6, 2024

Thanks @stephenkilbourn that sounds good!

@stephenkilbourn
Copy link
Contributor

I've added a branch with a small change in the stac_api/runtime/tests/conftest.py file. This gives a similar error on each of the attempts to POST: The error error:

>       response = self.api_client.post(
            collections_endpoint, json=self.invalid_stac_collection
        )
E       AttributeError: 'async_generator' object has no attribute 'post'

stac_api/runtime/tests/test_transactions.py:63: AttributeError

this got past the starlette error that we were seeing in develop:

self = <starlette.datastructures.State object at 0x10bf0b1f0>, key = 'get_connection'

    def __getattr__(self, key: typing.Any) -> typing.Any:
        try:
            return self._state[key]
        except KeyError:
            message = "'{}' object has no attribute '{}'"
>           raise AttributeError(message.format(self.__class__.__name__, key))
E           AttributeError: 'State' object has no attribute 'get_connection'

I'm at a loss on how to get past the new post error, though.

@smohiudd
Copy link
Contributor

@vincentsarago, are you able to help us with this??

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

No branches or pull requests

3 participants