Skip to content
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

Added view tests for CoursesIndexView #7

Merged
merged 1 commit into from
Apr 11, 2018

Conversation

johnbaldwin
Copy link
Contributor

  • Updated the mock model CourseOverview and factory code to provide both
    'org' and 'display_org_with_default' and make sure they have the same
    value when the model instance is created

- Updated the mock model CourseOverview and factory code to provide both
'org' and 'display_org_with_default' and make sure they have the same
value when the model instance is created
@johnbaldwin johnbaldwin changed the base branch from john/devsite-and-test-infrastructure to develop April 10, 2018 21:01
@johnbaldwin johnbaldwin reopened this Apr 10, 2018
Copy link
Contributor

@bryanlandia bryanlandia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine! but see a few comments.

]


# Look into renaming 'name' to 'display_name'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like you did this, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really. The field names in the models may not be the same name as found in the REST API data (defined in the serializer classes, see edx_figures/serializers.py). What I want to do is either remove the need to rename keys (which is unlikely) or find or write some key renaming class or method so I can just pass this as a parameter to model factory constructors instead of an explicit list of named parameters.

from .factories import CourseOverviewFactory

# Course data and generate method are duplicates course data in test_filters.py
COURSE_DATA = [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe throw in some non-ASCII chars to test edge cases

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! I'll add this when I refactor the course index test module. Created issue: #8

@@ -44,8 +44,15 @@ class CourseOverview(models.Model):
id = models.CharField(db_index=True, primary_key=True, max_length=255)
display_name = models.TextField(null=True)
org = models.TextField(max_length=255, default='outdated_entry')
# For the tests, the CourseOverviewFactory does a LazyAttribute on
# display_org_with_default
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want to eventually test that filtering is possible via display org as well as org?

Copy link
Contributor Author

@johnbaldwin johnbaldwin Apr 11, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! Added: #9

@johnbaldwin
Copy link
Contributor Author

@bryanlandia Thanks for reviewing!

@johnbaldwin johnbaldwin merged commit e30bbb9 into develop Apr 11, 2018
@johnbaldwin johnbaldwin deleted the john/course_index_test_view branch April 11, 2018 04:32
johnbaldwin pushed a commit to johnbaldwin/figures that referenced this pull request Oct 28, 2020
…travis

Add Juniper Tox environments to TravisCI file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants