File tree Expand file tree Collapse file tree 1 file changed +60
-0
lines changed
Expand file tree Collapse file tree 1 file changed +60
-0
lines changed Original file line number Diff line number Diff line change 1+ """
2+ Tests for the `openedx-ai-extensions` API endpoints.
3+ """
4+
5+ import pytest
6+ from django .contrib .auth import get_user_model
7+ from django .urls import reverse
8+ from opaque_keys .edx .keys import CourseKey
9+ from rest_framework .test import APIClient
10+
11+ User = get_user_model ()
12+
13+
14+ @pytest .fixture
15+ def api_client ():
16+ """
17+ Return a REST framework API client.
18+ """
19+ return APIClient ()
20+
21+
22+ @pytest .fixture
23+ def user ():
24+ """
25+ Create and return a test user.
26+ """
27+ return User .objects .create_user (
28+ username = "testuser" ,
email = "[email protected] " ,
password = "password123" 29+ )
30+
31+
32+ @pytest .fixture
33+ def staff_user ():
34+ """
35+ Create and return a test staff user.
36+ """
37+ return User .objects .create_user (
38+ username = "staffuser" ,
39+ 40+ password = "password123" ,
41+ is_staff = True ,
42+ )
43+
44+
45+ @pytest .fixture
46+ def course_key ():
47+ """
48+ Create and return a test course key.
49+ """
50+ return CourseKey .from_string ("course-v1:edX+DemoX+Demo_Course" )
51+
52+
53+ @pytest .mark .django_db
54+ def test_api_urls_are_registered ():
55+ """
56+ Test that the API URLs are properly registered and accessible.
57+ """
58+ # Test that the v1 workflows URL can be reversed
59+ url = reverse ("openedx_ai_extensions:api:v1:ai_pipelines" )
60+ assert url == "/openedx-ai-extensions/v1/workflows/"
You can’t perform that action at this time.
0 commit comments