Skip to content

feat: Setup test(unit and integration) flow with pytest #9

@tsotetsi

Description

@tsotetsi

Is your feature request related to a problem? Please describe.

Repository does not have tests(CI/CD).

Describe the solution you'd like

  • Add unit tests. We already have pytest and pytest-cov installed.
  • Set up GitHub workflow for running tests.(CI/CD).
  • Test Redis(redis_client.pint() should be enough). You can also check set/get.
  • Test PostgreSQL as well. Something like:
      result = await conn.fetchval("SELECT 1")
      assert result == 1

--

    @pytest.mark.asyncio
    async def test_database_tables_exist(self, db_session):
        """
        Test that basic queries work with SQLAlchemy AsyncSession.
        """
        try:
            result = await db_session.execute(text("SELECT version()"))
            db_version = result.scalar()
            assert "PostgreSQL" in db_version
            print(f"✅ Database version: {db_version}")
        except Exception as e:
            pytest.fail(f"Query execution failed: {e}")

Describe alternatives you've considered

None.

Additional context

CI/CD Pipeline should be green.

Implementation Ideas (Optional)

None

Sub-issues

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions