Skip to content

Commit

Permalink
Fix part of oppia#4374: Adds docstring in core/domain/exp_services_te…
Browse files Browse the repository at this point in the history
…st.py (oppia#6027)

* Add docstring in core/domain/exp_services_test.py

* Address comments on docstrings
  • Loading branch information
dev-ritik authored and vibhor98 committed Dec 25, 2018
1 parent b27bb32 commit a0e721c
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions core/domain/exp_services_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@


def _count_at_least_editable_exploration_summaries(user_id):
"""Counts exp summaries that are at least editable by the given user.
Args:
user_id: unicode. The id of the given user.
Returns:
int. The number of exploration summaries that are at least editable
by the given user.
"""
return len(exp_services._get_exploration_summaries_from_models( # pylint: disable=protected-access
exp_models.ExpSummaryModel.get_at_least_editable(
user_id=user_id)))
Expand Down Expand Up @@ -195,6 +204,16 @@ def setUp(self):
self.EXP_ID_4, self.EXP_ID_5, self.EXP_ID_6])

def _create_search_query(self, terms, categories, languages):
"""Creates search query from list of arguments.
Args:
terms: list(str). A list of terms to be added in the query.
categories: list(str). A list of categories to be added in the query.
languages: list(str). A list of languages to be added in the query.
Returns:
str. A search query string.
"""
query = ' '.join(terms)
if categories:
query += ' category=(' + ' OR '.join([
Expand Down Expand Up @@ -2461,6 +2480,7 @@ def setUp(self):
# puts to the event log are asynchronous.
@transaction_services.toplevel_wrapper
def populate_datastore():
"""Populates the database according to the sequence."""
exploration_1 = self.save_new_valid_exploration(
self.EXP_ID_1, self.albert_id)

Expand Down Expand Up @@ -2687,6 +2707,16 @@ def test_contributors_not_updated_on_revert(self):
self.assertEqual([albert_id], exploration_summary.contributor_ids)

def _check_contributors_summary(self, exp_id, expected):
"""Check if contributors summary of the given exp is same as expected.
Args:
exp_id: str. The id of the exploration.
expected: dict(unicode, int). Expected summary.
Raises:
AssertionError: Contributors summary of the given exp is not same
as expected.
"""
contributors_summary = exp_services.get_exploration_summary_by_id(
exp_id).contributors_summary
self.assertEqual(expected, contributors_summary)
Expand Down

0 comments on commit a0e721c

Please sign in to comment.