NASA-IMPACT / veda-backend

Backend services for VEDA
Other
13 stars 5 forks source link

Fix unit tests for STAC transactions #413

Open slesaad opened 3 months ago

slesaad commented 3 months ago

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

smohiudd commented 3 months ago

@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 commented 3 months ago

@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 commented 3 months ago

Thanks @stephenkilbourn that sounds good!

stephenkilbourn commented 2 months ago

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 commented 2 months ago

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