MCPcopy
hub / github.com/TransformerOptimus/SuperAGI / test_find_by_id

Function test_find_by_id

tests/unit_tests/models/test_project.py:25–42  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

23 assert project == mock_project
24
25def test_find_by_id():
26 # Create a mock session
27 session = create_autospec(Session)
28
29 # Create a sample project ID
30 project_id = 123
31
32 # Create a mock project object to be returned by the session query
33 mock_project = Project(id=project_id, name="Test Project", organisation_id=1, description="Project for testing")
34
35 # Configure the session query to return the mock project
36 session.query.return_value.filter.return_value.first.return_value = mock_project
37
38 # Call the method under test
39 project = Project.find_by_id(session, project_id)
40
41 # Assert that the returned project object matches the mock project
42 assert project == mock_project

Callers

nothing calls this directly

Calls 2

ProjectClass · 0.90
find_by_idMethod · 0.45

Tested by

no test coverage detected