File size: 6,323 Bytes
248474f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# Govt. Science College Durg - Student Query API Test Report

This document records the verification tests executed against the `science_source` FastAPI backend service.

*   **Service Endpoint**: `http://127.0.0.1:8000/api/results`
*   **Test Date**: July 17, 2026
*   **Status**: All Tests Passed Successfully

---

## Test Case 1: Exact Roll Number Lookup in Database Mode (`mode=db`)

*   **Objective**: Verify that the API instantly returns the full detailed JSON profile for an indexed roll number using memory indexes.
*   **Command**:
    ```bash
    curl -s "http://127.0.0.1:8000/api/results?rollno=2221002&mode=db"
    ```
*   **Response Summary (Truncated JSON)**:
    ```json
    [
        {
            "roll_no": "2221002",
            "fin_year": "2024-2025",
            "stream_name": "B.A. SEMESTER-I",
            "profile": {
                "name": "AAMNI KOSHLE",
                "mobile_no": "7898503991",
                "roll_no": "2221002",
                "enroll_no": "HU/301/230010004",
                "father_name": "RESHAM LAL KOSHLE",
                "mother_name": "SARITA KOSHLE",
                "category": "SC",
                "dob": "29.06.2004",
                "address": "36,Nardaha,Dhansuli,Raipur ,",
                "photo_url": "https://govtsciencecollegedurg.onlineexamforms.com/Photo_New/6200.jpg",
                "signature_url": "https://govtsciencecollegedurg.onlineexamforms.com/Images/nophoto.gif",
                "email": "koshleaamni@gmail.com",
                "local_photo_path": "media/2221002_photo.jpg",
                "local_signature_path": ""
            },
            "supplementary_info": {
                "last_date_form_submission": "25-Jul-2022",
                "total_subjects_selected": "0",
                "total_fees": ""
            },
            "course_history": [
                {
                    "class": "B.A. SEMESTER-I",
                    "s_no": "1",
                    "exam_roll_no": "2221002",
                    "status": "ATKT"
                }
            ],
            "transaction_history": [
                {
                    "class": "B.A. SEMESTER-III",
                    "merchant_txn_no": "11000252635963",
                    "paid_fees": "640.00",
                    "payment_status": "Success"
                }
            ],
            "source": "db"
        }
    ]
    ```
*   **Result**: **PASS** (Profile, registration timeline, and transaction histories mapped correctly with `"source": "db"`).

---

## Test Case 2: Student Name Query Search (`mode=db`)

*   **Objective**: Verify that searching for a student by name returns matching student listings (both full DB profiles and partial CSV references).
*   **Command**:
    ```bash
    curl -s "http://127.0.0.1:8000/api/results?rollno=anita&mode=db"
    ```
*   **Response Summary (Truncated JSON)**:
    ```json
    [
        {
            "roll_no": "2221009",
            "fin_year": "2024-2025",
            "stream_name": "B.A. SEMESTER-I",
            "profile": {
                "name": "ANITA NAYAK",
                "mobile_no": "9179593812",
                "father_name": "BHARAT NAYAK",
                "category": "GEN"
            },
            "source": "db"
        }
    ]
    ```
*   **Result**: **PASS** (Returned match for "ANITA NAYAK").

---

## Test Case 3: Live Portal Scrape lookup (`mode=live`)

*   **Objective**: Verify that the live scraper logs in to the official exam portal dynamically, resolves the class ID via suffix-guessing, parses the student details, and returns the response in a unified format.
*   **Command**:
    ```bash
    curl -s "http://127.0.0.1:8000/api/results?rollno=2221002&mode=live"
    ```
*   **Response Summary (Truncated JSON)**:
    ```json
    [
        {
            "roll_no": "2221002",
            "fin_year": "2024-2025",
            "stream_name": "B.A. SEMESTER-III",
            "profile": {
                "name": "AAMNI KOSHLE",
                "enroll_no": "HU/301/230010004",
                "photo_url": "https://govtsciencecollegedurg.onlineexamforms.com/Photo_New/6200.jpg"
            },
            "course_history": [
                {
                    "class": "B.A. SEMESTER-I",
                    "status": "ATKT"
                },
                {
                    "class": "B.A. SEMESTER-III",
                    "status": "ATKT"
                }
            ],
            "source": "live"
        }
    ]
    ```
*   **Result**: **PASS** (Live state scraped successfully from exam portal. Note that `stream_name` resolved to `B.A. SEMESTER-III`, reflecting the student's current live academic enrollment instead of the cached `SEMESTER-I` database reference).

---

## Test Case 4: Non-Existent Search Query

*   **Objective**: Verify that querying an invalid number returns an empty listing without exceptions.
*   **Command**:
    ```bash
    curl -s "http://127.0.0.1:8000/api/results?rollno=9999999&mode=db"
    ```
*   **Response**:
    ```json
    []
    ```
*   **Result**: **PASS** (Clean empty array returned).

---

## Test Case 5: Live Scrape on Unknown Prefix

*   **Objective**: Verify that requesting a live lookup on an unknown prefix that cannot be correlated raises an informative HTTP 400 error.
*   **Command**:
    ```bash
    curl -s "http://127.0.0.1:8000/api/results?rollno=9999999&mode=live"
    ```
*   **Response**:
    ```json
    {
        "detail": "Course class could not be resolved automatically for this roll number. Please specify the course class option manually."
    }
    ```
*   **Result**: **PASS** (HTTP 400 with instruction raised).

---

## Test Case 6: Live Scrape with Manual Override and Non-Existent Record

*   **Objective**: Verify that manually overriding the Course ID but passing an invalid roll number query routes correctly to the portal and raises a 401 login warning with details from the portal alert.
*   **Command**:
    ```bash
    curl -s "http://127.0.0.1:8000/api/results?rollno=9999999&mode=live&class_id=138"
    ```
*   **Response**:
    ```json
    {
        "detail": "Live scraper failed or student record not found on exam portal: 401: Exam Portal login failed: No Record Found"
    }
    ```
*   **Result**: **PASS** (Returned 401 portal message "No Record Found").