-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix a proxy model bug related to ad-free #4390
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ | |
from readthedocs.builds.models import Build, BuildCommandResult, Version | ||
from readthedocs.integrations.models import Integration | ||
from readthedocs.oauth.models import RemoteOrganization, RemoteRepository | ||
from readthedocs.projects.models import Feature, Project | ||
from readthedocs.projects.models import Feature, Project, APIProject | ||
from readthedocs.restapi.views.integrations import GitHubWebhookView | ||
from readthedocs.restapi.views.task_views import get_status_data | ||
|
||
|
@@ -564,6 +564,24 @@ def test_remote_organization_pagination(self): | |
self.assertEqual(len(resp.data['results']), 25) # page_size | ||
self.assertIn('?page=2', resp.data['next']) | ||
|
||
def test_init_api_project(self): | ||
project_data = { | ||
'name': 'Test Project', | ||
'slug': 'test-project', | ||
'show_advertising': True, | ||
} | ||
|
||
api_project = APIProject(**project_data) | ||
self.assertEqual(api_project.slug, 'test-project') | ||
self.assertEquals(api_project.features, []) | ||
self.assertEqual(api_project.ad_free, False) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: I think it's better to use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ya, you're right. I don't know why I did that. |
||
|
||
project_data['features'] = ['test-feature'] | ||
project_data['show_advertising'] = False | ||
api_project = APIProject(**project_data) | ||
self.assertEquals(api_project.features, ['test-feature']) | ||
self.assertEqual(api_project.ad_free, True) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe adding an assert for the |
||
|
||
|
||
class APIImportTests(TestCase): | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason to uses
assertEquals
and notassertEqual
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like
assertEqual
is preferred. I never gave it much thought but I think I use the plural with lists/sets/tuples. I'll switch to singular.