|
20 | 20 | from readthedocs.builds.models import Build, BuildCommandResult, Version
|
21 | 21 | from readthedocs.integrations.models import Integration
|
22 | 22 | from readthedocs.oauth.models import RemoteOrganization, RemoteRepository
|
23 |
| -from readthedocs.projects.models import Feature, Project |
| 23 | +from readthedocs.projects.models import Feature, Project, APIProject |
24 | 24 | from readthedocs.restapi.views.integrations import GitHubWebhookView
|
25 | 25 | from readthedocs.restapi.views.task_views import get_status_data
|
26 | 26 |
|
@@ -564,6 +564,26 @@ def test_remote_organization_pagination(self):
|
564 | 564 | self.assertEqual(len(resp.data['results']), 25) # page_size
|
565 | 565 | self.assertIn('?page=2', resp.data['next'])
|
566 | 566 |
|
| 567 | + def test_init_api_project(self): |
| 568 | + project_data = { |
| 569 | + 'name': 'Test Project', |
| 570 | + 'slug': 'test-project', |
| 571 | + 'show_advertising': True, |
| 572 | + } |
| 573 | + |
| 574 | + api_project = APIProject(**project_data) |
| 575 | + self.assertEqual(api_project.slug, 'test-project') |
| 576 | + self.assertEqual(api_project.features, []) |
| 577 | + self.assertFalse(api_project.ad_free) |
| 578 | + self.assertTrue(api_project.show_advertising) |
| 579 | + |
| 580 | + project_data['features'] = ['test-feature'] |
| 581 | + project_data['show_advertising'] = False |
| 582 | + api_project = APIProject(**project_data) |
| 583 | + self.assertEqual(api_project.features, ['test-feature']) |
| 584 | + self.assertTrue(api_project.ad_free) |
| 585 | + self.assertFalse(api_project.show_advertising) |
| 586 | + |
567 | 587 |
|
568 | 588 | class APIImportTests(TestCase):
|
569 | 589 |
|
|
0 commit comments