Skip to content

Commit

Permalink
include unit tesT
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron Kanzer authored and Aaron Kanzer committed Nov 25, 2024
1 parent bdbeb30 commit 1e3d6d9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions dandiapi/api/tests/test_robots.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import pytest
from django.urls import reverse

@pytest.mark.django_db
def test_robots_txt(api_client):
response = api_client.get(reverse('robots_txt'))
assert response.status_code == 200
assert response['Content-Type'] == 'text/plain'
expected_content = """
User-agent: *
Disallow: /
"""
assert response.content.decode('utf-8').strip() == expected_content.strip()
2 changes: 1 addition & 1 deletion dandiapi/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def to_url(self, value):
register_converter(DandisetIDConverter, 'dandiset_id')
urlpatterns = [
path('', root_content_view),
path("robots.txt", robots_txt_view),
path('robots.txt', robots_txt_view),
path('api/', include(router.urls)),
path('api/auth/token/', auth_token_view, name='auth-token'),
path('api/stats/', stats_view),
Expand Down

0 comments on commit 1e3d6d9

Please sign in to comment.