Skip to content

Commit

Permalink
Fix one more unicode error. Modify test so these errors don't recur i…
Browse files Browse the repository at this point in the history
…n the future. Change color of admin banner page to differentiate it from the main server. (oppia#2512)
  • Loading branch information
seanlip authored and BenHenning committed Sep 26, 2016
1 parent 300fda6 commit afdc830
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 19 deletions.
6 changes: 3 additions & 3 deletions core/domain/stats_jobs_one_off.py
Original file line number Diff line number Diff line change
Expand Up @@ -1207,7 +1207,7 @@ def reduce(key, stringified_values):
# condition since the order of value_dict_list is not deterministic.
first_value_dict = value_dict_list[0]
exploration_id = first_value_dict['exploration_id']
state_name = first_value_dict['state_name']
state_name = first_value_dict['state_name'].decode('utf-8')

# One major point of failure is the exploration not existing. Another
# major point of failure comes from the time matching.
Expand Down Expand Up @@ -1240,8 +1240,8 @@ def reduce(key, stringified_values):
yield (
'Item ID: %s, last updated: %s, state name: %s, '
'exp id: %s, error: %s' % (
item_id, last_updated, state_name, exploration_id,
error))
item_id, last_updated, state_name.encode('utf-8'),
exploration_id, error))

@classmethod
def _migrate_answers(cls, item_id, explorations, exploration_id, state_name,
Expand Down
24 changes: 13 additions & 11 deletions core/domain/stats_jobs_one_off_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,10 @@ def setUp(self):
user_services.get_or_create_user(self.owner_id, self.OWNER_EMAIL)
self.signup(self.OWNER_EMAIL, self.OWNER_USERNAME)

self.text_input_state_name = self.exploration.init_state_name

def test_fuzzy_matches_does_not_migrate(self):
state_name = 'Text Input'
state_name = self.text_input_state_name

rule_spec_str = 'FuzzyMatches'
html_answer = 'weight'
Expand Down Expand Up @@ -147,7 +149,7 @@ def test_supports_migrating_params_out_of_order(self):
self._verify_no_migration_validation_problems()

def test_migrated_answer_from_deleted_exploration_is_still_migrated(self):
state_name = 'Text Input'
state_name = self.text_input_state_name

rule_spec_str = 'Contains(ate)'
html_answer = 'appreciate'
Expand Down Expand Up @@ -181,7 +183,7 @@ def test_migrated_answer_from_deleted_exploration_is_still_migrated(self):
self._verify_no_migration_validation_problems()

def test_migrated_answer_from_fully_deleted_exploration_is_migrated(self):
state_name = 'Text Input'
state_name = self.text_input_state_name

rule_spec_str = 'Contains(ate)'
html_answer = 'appreciate'
Expand Down Expand Up @@ -284,7 +286,7 @@ def test_rule_parameter_evaluation_with_invalid_characters(self):
self._verify_migration_validation_problems(1)

def test_multiple_migrations_does_not_duplicate_answers(self):
state_name = 'Text Input'
state_name = self.text_input_state_name

rule_spec_str = 'Contains(ate)'
self._record_old_answer(state_name, rule_spec_str, 'levitate')
Expand Down Expand Up @@ -312,7 +314,7 @@ def test_multiple_migrations_does_not_duplicate_answers(self):
self._verify_no_migration_validation_problems()

def test_migration_results_can_be_validated(self):
state_name1 = 'Text Input'
state_name1 = self.text_input_state_name
rule_spec_str1 = 'Contains(ate)'

state_name2 = 'Code Editor'
Expand Down Expand Up @@ -397,7 +399,7 @@ def test_migration_job_should_support_very_large_answers(self):
large numbers of answers to the new data store that would require the
new data store to begin using its linked-list functionality.
"""
state_name = 'Text Input'
state_name = self.text_input_state_name

rule_spec_str = 'Contains(ate)'
html_answer = ''.join([str(x) for x in xrange(1024)])
Expand All @@ -422,7 +424,7 @@ def test_migration_job_should_migrate_100_answers(self):
since it splits up answers in batches of 100 for less intense
submission.
"""
state_name = 'Text Input'
state_name = self.text_input_state_name

rule_spec_str = 'Contains(ate)'
html_answer = 'Plate'
Expand All @@ -446,7 +448,7 @@ def test_migration_job_should_migrate_101_answers(self):
since it splits up answers in batches of 100 for less intense
submission.
"""
state_name = 'Text Input'
state_name = self.text_input_state_name

rule_spec_str = 'Contains(ate)'
html_answer = 'Plate'
Expand All @@ -470,7 +472,7 @@ def test_migration_job_should_migrate_200_answers(self):
since it splits up answers in batches of 100 for less intense
submission.
"""
state_name = 'Text Input'
state_name = self.text_input_state_name

rule_spec_str = 'Contains(ate)'
html_answer = 'Plate'
Expand Down Expand Up @@ -1591,7 +1593,7 @@ def test_migrate_set_input_with_html(self):
self._verify_no_migration_validation_problems()

def test_migrate_text_input(self):
state_name = 'Text Input'
state_name = self.text_input_state_name

rule_spec_str = 'Contains(ate)'
html_answer = 'appreciate'
Expand Down Expand Up @@ -1627,7 +1629,7 @@ def test_migrate_text_input_with_illegal_characters(self):
characters like '<' and '>' are migrated. This test is based on an
exploration found in production.
"""
state_name = 'Text Input'
state_name = self.text_input_state_name

rule_spec_str = 'Contains(ate)'
html_answer = 'Let f(x)<|a|'
Expand Down
6 changes: 4 additions & 2 deletions core/templates/dev/head/admin/admin.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,17 @@

<body ng-controller="Admin" ng-cloak>
<nav class="navbar navbar-default oppia-navbar oppia-prevent-selection" role="navigation">
<div class="navbar-container" style="background-color: #00376d">
<!-- IMPORTANT: The change to the navbar color should be reverted prior to merge into develop. -->
<div class="navbar-container" style="background-color: #666">
<div class="navbar-header protractor-test-navbar-header pull-left">
<a class="oppia-navbar-brand-name oppia-transition-200" href="/library">
<img src="/images/logo/288x128_logo_white.png" class="oppia-logo" ng-class="'oppia-logo-wide'">
</a>
<ul class="nav navbar-nav oppia-navbar-breadcrumb">
<li>
<span class="oppia-navbar-breadcrumb-separator"></span>
Admin
<!-- IMPORTANT: The change to this text should be reverted prior to merge into develop. -->
Admin (answer-migration branch)
</li>
</ul>
</div>
Expand Down
6 changes: 3 additions & 3 deletions data/explorations/all_interactions/all_interactions.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
author_notes: ''
blurb: ''
category: Test
init_state_name: Text Input
init_state_name: "Text Input state name with unicode \u0105\u0142"
language_code: en
objective: Dummy exploration for testing all interactions
param_changes: []
Expand Down Expand Up @@ -752,7 +752,7 @@ states:
trigger_type: NthResubmission
id: SetInput
param_changes: []
Text Input:
"Text Input state name with unicode \u0105\u0142":
content:
- type: text
value: <p>Text input. Please add a word containing "ate".</p>
Expand All @@ -774,7 +774,7 @@ states:
rows:
value: 1
default_outcome:
dest: Text Input
dest: "Text Input state name with unicode \u0105\u0142"
feedback:
- <p>The answer needs to contain "ate".</p>
param_changes: []
Expand Down

0 comments on commit afdc830

Please sign in to comment.