def test__CanonicalizeQuestions_replaces_urls_with_placeholder(self): results = [r for r in self.mock_results if r['survey_type'] == 'ssl-overridable-proceed.js'] processresults._CanonicalizeQuestions(results) for r in results: self.assertEqual( r['responses'][0]['question'], 'blah "[CHOSEN]" "[ALTERNATIVE]." blah')
def test__CanonicalizeQuestions_filters_out_placeholder_questions(self): results = [ r for r in self.mock_results if r['survey_type'] == 'malware-noproceed.js' ] processresults._CanonicalizeQuestions(results) self.assertEqual(len(results), 1) self.assertNotEqual(results[0]['responses'][0]['question'], 'PLACEHOLDER')
def test__CanonicalizeQuestions_replaces_urls_with_placeholder(self): results = [ r for r in self.mock_results if r['survey_type'] == 'ssl-overridable-proceed.js' ] processresults._CanonicalizeQuestions(results) for r in results: self.assertEqual(r['responses'][0]['question'], 'blah "[CHOSEN]" "[ALTERNATIVE]." blah')
def test__CanonicalizeQuestions_filters_out_placeholder_questions(self): results = [r for r in self.mock_results if r['survey_type'] == 'malware-noproceed.js'] results, canonical_index = processresults._CanonicalizeQuestions(results) self.assertEqual(len(results), 1) self.assertNotEqual(results[0]['responses'][0]['question'], 'PLACEHOLDER')
def test__CanonicalizeQuestions_returns_canonical_index(self): results = [r for r in self.mock_results if r['survey_type'] == 'ssl-overridable-proceed.js'] results, canonical_index = processresults._CanonicalizeQuestions(results) # 2nd item (index 1) in mock_results should be selected as canonical self.assertEqual(canonical_index, 1)
def test__CanonicalizeQuestions_returns_canonical_index(self): results = [ r for r in self.mock_results if r['survey_type'] == 'ssl-overridable-proceed.js' ] canonical_index = processresults._CanonicalizeQuestions(results) # 2nd item (index 1) in mock_results should be selected as canonical self.assertEqual(canonical_index, 1)
def test__CanonicalizeQuestions_reorders_attribute_questions(self): results = [r for r in self.mock_results if r['survey_type'] == 'ssl-overridable-proceed.js'] processresults._CanonicalizeQuestions(results) self.assertEqual(len(results), 3) for r in results: self.assertEqual( r['responses'][3]['question'], ('To what degree do each of the following adjectives ' 'describe this page?(A)')) self.assertEqual( r['responses'][4]['question'], ('To what degree do each of the following adjectives ' 'describe this page?(B)')) self.assertEqual( r['responses'][5]['question'], ('To what degree do each of the following adjectives ' 'describe this page?(C)'))
def test__CanonicalizeQuestions_reorders_attribute_questions(self): results = [ r for r in self.mock_results if r['survey_type'] == 'ssl-overridable-proceed.js' ] processresults._CanonicalizeQuestions(results) self.assertEqual(len(results), 3) for r in results: self.assertEqual( r['responses'][3]['question'], ('To what degree do each of the following adjectives ' 'describe this page?(A)')) self.assertEqual( r['responses'][4]['question'], ('To what degree do each of the following adjectives ' 'describe this page?(B)')) self.assertEqual( r['responses'][5]['question'], ('To what degree do each of the following adjectives ' 'describe this page?(C)'))