Coverage for backend/tests/routers/test_export.py: 100%

8 statements  

« prev     ^ index     » next       coverage.py v7.10.7, created at 2025-09-22 15:38 +0000

1"""Tests for export endpoint""" 

2 

3 

4class TestExport: 

5 

6 def test_export_data( 

7 self, 

8 authorised_clients, 

9 test_jobs, 

10 test_interviews, 

11 test_job_application_updates, 

12 test_companies, 

13 test_keywords, 

14 test_aggregators, 

15 test_users, 

16 ) -> None: 

17 """Test export endpoint returns CSV data with all columns and related data""" 

18 

19 response = authorised_clients[0].get("/export") 

20 assert response.status_code == 200 

21 

22 def test_export_no_data(self, authorised_clients) -> None: 

23 """Test export endpoint when no jobs exist""" 

24 

25 response = authorised_clients[0].get("/export") 

26 assert response.status_code == 200 

27 assert response.content.decode() == ( 

28 "title,description,salary_min,salary_max,personal_rating,url,deadline,note," 

29 "attendance_type,application_date,application_url,application_status," 

30 "application_note,applied_via,created_at,modified_at,Company,Location," 

31 "Source Aggregator,Application Aggregator,Keywords,Contacts,Interviews,Updates\r\n" 

32 )