core/domain/exp_services_test.py
File exp_services_test.py
has 8658 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
# coding: utf-8
#
# Copyright 2014 The Oppia Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
ExplorationCreateAndDeleteUnitTests
has 38 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class ExplorationCreateAndDeleteUnitTests(ExplorationServicesUnitTests):
"""Test creation and deletion methods."""
def test_soft_deletion_of_exploration(self) -> None:
"""Test that soft deletion of exploration works correctly."""
UpdateStateTests
has 28 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class UpdateStateTests(ExplorationServicesUnitTests):
"""Test updating a single state."""
def setUp(self) -> None:
super().setUp()
ExplorationConversionPipelineTests
has 25 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class ExplorationConversionPipelineTests(ExplorationServicesUnitTests):
"""Tests the exploration model -> exploration conversion pipeline."""
NEW_EXP_ID: Final = 'exp_id1'
Function test_logged_in_user_progress_is_updated_correctly
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def test_logged_in_user_progress_is_updated_correctly(self) -> None:
self.login(self.VIEWER_EMAIL)
exp_user_data = exp_fetchers.get_exploration_user_data(
self.viewer_id, self.EXP_ID)
self.assertIsNone(exp_user_data)
Function test_get_image_filenames_from_exploration
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def test_get_image_filenames_from_exploration(self) -> None:
exploration = exp_domain.Exploration.create_default_exploration(
'eid', title='title', category='category')
exploration.add_states(['state1', 'state2', 'state3'])
state1 = exploration.states['state1']
Function test_logged_out_user_checkpoint_progress_is_updated_correctly
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def test_logged_out_user_checkpoint_progress_is_updated_correctly(
self
) -> None:
logged_out_user_data = exp_fetchers.get_logged_out_user_progress(
self.UNIQUE_PROGRESS_URL_ID
Function test_update_interaction_answer_groups
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def test_update_interaction_answer_groups(self) -> None:
"""Test updating of interaction_answer_groups."""
# We create a second state to use as a rule destination.
exploration = exp_fetchers.get_exploration_by_id(self.EXP_0_ID)
content_id_generator = translation_domain.ContentIdGenerator(
Function test_get_exploration_snapshots_metadata
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def test_get_exploration_snapshots_metadata(self) -> None:
self.signup(self.SECOND_EMAIL, self.SECOND_USERNAME)
second_committer_id = self.get_user_id_from_email(self.SECOND_EMAIL)
v1_exploration = self.save_new_valid_exploration(
Function test_versioning_with_add_and_delete_states
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def test_versioning_with_add_and_delete_states(self) -> None:
exploration = self.save_new_valid_exploration(
self.EXP_0_ID, self.owner_id)
change_list = [exp_domain.ExplorationChange({
Function test_soft_deletion_of_multiple_explorations
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def test_soft_deletion_of_multiple_explorations(self) -> None:
"""Test that soft deletion of explorations works correctly."""
# TODO(sll): Add tests for deletion of states and version snapshots.
self.save_new_default_exploration(self.EXP_0_ID, self.owner_id)
Function test_export_by_versions
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def test_export_by_versions(self) -> None:
"""Test export_to_dict() for different versions."""
self.maxDiff = None
exploration = self.save_new_valid_exploration(
self.EXP_0_ID, self.owner_id)
Function test_export_by_versions
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def test_export_by_versions(self) -> None:
"""Test export_to_zip_file() for different versions."""
exploration = self.save_new_valid_exploration(
self.EXP_0_ID, self.owner_id, objective='The objective',
category='Algebra')
Function test_update_interaction_solutions
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def test_update_interaction_solutions(self) -> None:
exploration = exp_fetchers.get_exploration_by_id(self.NEW_EXP_ID)
self.assertIsNone(exploration.init_state.interaction.solution)
solution: Optional[state_domain.SolutionDict] = {