Skip to content

Commit fb57c51

Browse files
committed
fix: unit tests, remove deprecated is_index from jinja templates
1 parent 373fe34 commit fb57c51

File tree

4 files changed

+11
-17
lines changed

4 files changed

+11
-17
lines changed

src/server/templates/components/git_form.jinja

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@
3434
<img src="https://cdn.devdojo.com/images/january2023/shape-1.png"
3535
class="absolute md:block hidden left-0 h-[4.5rem] w-[4.5rem] bottom-0 -translate-x-full ml-3">
3636
<!-- Ingest Form -->
37-
<form id="ingestForm"
38-
method="post"
39-
onsubmit="handleSubmit(event{% if is_index %}, true{% endif %})">
37+
<form id="ingestForm" method="post" onsubmit="handleSubmit(event, true)">
4038
<!-- Top row: repo URL + Ingest button -->
4139
<div class="flex md:flex-row flex-col w-full h-full justify-center items-stretch space-y-5 md:space-y-0 md:space-x-5">
4240
<!-- Repository URL Input -->

src/server/templates/git.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
id="error-message"
66
data-message="{{ error_message }}">{{ error_message }}</div>
77
{% endif %}
8-
{% with is_index=false, show_examples=false %}
8+
{% with show_examples=false %}
99
{% include 'components/git_form.jinja' %}
1010
{% endwith %}
1111
{% include 'components/result.jinja' %}

src/server/templates/index.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
id="error-message"
4848
data-message="{{ error_message }}">{{ error_message }}</div>
4949
{% endif %}
50-
{% with is_index=true, show_examples=true %}
50+
{% with show_examples=true %}
5151
{% include 'components/git_form.jinja' %}
5252
{% endwith %}
5353
<p class="text-gray-600 text-sm max-w-2xl mx-auto text-center mt-4">

tests/test_flow_integration.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -95,18 +95,17 @@ async def test_invalid_repository_url(request: pytest.FixtureRequest) -> None:
9595
async def test_large_repository(request: pytest.FixtureRequest) -> None:
9696
"""Simulate analysis of a large repository with nested folders."""
9797
client = request.getfixturevalue("test_client")
98+
# TODO: ingesting a large repo take too much time (eg: godotengine/godot repository)
9899
form_data = {
99-
"input_text": "https://github.com/large/repo-with-many-files",
100-
"max_file_size": "243",
100+
"input_text": "https://github.com/octocat/hello-world",
101+
"max_file_size": "10",
101102
"pattern_type": "exclude",
102103
"pattern": "",
103104
"token": "",
104105
}
105106

106107
response = client.post("/api/ingest", data=form_data)
107-
# This might fail with 400 if repo doesn't exist, or succeed with 200
108-
_valid = {status.HTTP_200_OK, status.HTTP_400_BAD_REQUEST}
109-
assert response.status_code in _valid, f"Request failed: {response.text}"
108+
assert response.status_code == status.HTTP_200_OK, f"Request failed: {response.text}"
110109

111110
response_data = response.json()
112111
if response.status_code == status.HTTP_200_OK:
@@ -123,15 +122,14 @@ async def test_concurrent_requests(request: pytest.FixtureRequest) -> None:
123122

124123
def make_request() -> None:
125124
form_data = {
126-
"input_text": "https://github.com/octocat/Hello-World",
125+
"input_text": "https://github.com/octocat/hello-world",
127126
"max_file_size": "243",
128127
"pattern_type": "exclude",
129128
"pattern": "",
130129
"token": "",
131130
}
132131
response = client.post("/api/ingest", data=form_data)
133-
_valid = {status.HTTP_200_OK, status.HTTP_400_BAD_REQUEST}
134-
assert response.status_code in _valid, f"Request failed: {response.text}"
132+
assert response.status_code == status.HTTP_200_OK, f"Request failed: {response.text}"
135133

136134
response_data = response.json()
137135
if response.status_code == status.HTTP_200_OK:
@@ -159,8 +157,7 @@ async def test_large_file_handling(request: pytest.FixtureRequest) -> None:
159157
}
160158

161159
response = client.post("/api/ingest", data=form_data)
162-
_valid = {status.HTTP_200_OK, status.HTTP_400_BAD_REQUEST}
163-
assert response.status_code in _valid, f"Request failed: {response.text}"
160+
assert response.status_code == status.HTTP_200_OK, f"Request failed: {response.text}"
164161

165162
response_data = response.json()
166163
if response.status_code == status.HTTP_200_OK:
@@ -183,8 +180,7 @@ async def test_repository_with_patterns(request: pytest.FixtureRequest) -> None:
183180
}
184181

185182
response = client.post("/api/ingest", data=form_data)
186-
_valid = {status.HTTP_200_OK, status.HTTP_400_BAD_REQUEST}
187-
assert response.status_code in _valid, f"Request failed: {response.text}"
183+
assert response.status_code == status.HTTP_200_OK, f"Request failed: {response.text}"
188184

189185
response_data = response.json()
190186
if response.status_code == status.HTTP_200_OK:

0 commit comments

Comments
 (0)