def test_action(self): jd = copy.deepcopy(cannonical_json_dump) processed_crash = DotDict() processed_crash.json_dump = jd raw_crash = DotDict() raw_crash.ProductName = 'Firefox' raw_crash.Version = '16' raw_dumps = {} fake_processor = create_basic_fake_processor() classifier = OutOfDateClassifier() classifier.out_of_date_threshold = ('17', ) processed_crash.json_dump['system_info']['os'] = 'Mac OS X' processed_crash.json_dump['system_info']['os_ver'] = '10.1' processed_crash.json_dump['system_info']['cpu_arch'] = 'ppc' ok_( classifier._action(raw_crash, raw_dumps, processed_crash, fake_processor)) eq_(processed_crash.classifications.support.classification, 'firefox-no-longer-works-mac-os-10-4-or-powerpc') processed_crash.json_dump['system_info']['os'] = 'Windows NT' processed_crash.json_dump['system_info']['os_ver'] = \ '5.1.2600 Service Pack 3' ok_( classifier._action(raw_crash, raw_dumps, processed_crash, fake_processor)) eq_(processed_crash.classifications.support.classification, 'update-firefox-latest-version')
def test_predicate(self): jd = copy.deepcopy(cannonical_json_dump) processed_crash = DotDict() processed_crash.json_dump = jd raw_crash = DotDict() raw_crash.ProductName = 'Firefox' raw_crash.Version = '16' raw_dumps = {} fake_processor = create_basic_fake_processor() fake_processor.config.firefox_out_of_date_version = '17' classifier = OutOfDateClassifier() ok_( classifier._predicate(raw_crash, raw_dumps, processed_crash, fake_processor)) raw_crash.Version = '19' ok_(not classifier._predicate(raw_crash, raw_dumps, processed_crash, fake_processor)) raw_crash.Version = '12' raw_crash.ProductName = 'NotFireFox' ok_(not classifier._predicate(raw_crash, raw_dumps, processed_crash, fake_processor))
def test_predicate(self): jd = copy.deepcopy(cannonical_json_dump) processed_crash = DotDict() processed_crash.json_dump = jd raw_crash = DotDict() raw_crash.ProductName = 'Firefox' raw_crash.Version = '16' fake_processor = create_basic_fake_processor() fake_processor.config.firefox_out_of_date_version = '17' classifier = OutOfDateClassifier() self.assertTrue(classifier._predicate( raw_crash, processed_crash, fake_processor )) raw_crash.Version = '19' self.assertFalse(classifier._predicate( raw_crash, processed_crash, fake_processor )) raw_crash.Version = '12' raw_crash.ProductName = 'NotFireFox' self.assertFalse(classifier._predicate( raw_crash, processed_crash, fake_processor ))
def test_windows_action(self): jd = copy.deepcopy(cannonical_json_dump) processed_crash = DotDict() processed_crash.json_dump = jd raw_crash = DotDict() raw_crash.ProductName = 'Firefox' raw_crash.Version = '16' raw_dumps = {} fake_processor = create_basic_fake_processor() classifier = OutOfDateClassifier() classifier.out_of_date_threshold = ('17',) processed_crash.json_dump['system_info']['os'] = 'Windows NT' processed_crash.json_dump['system_info']['os_ver'] = \ '5.1.2600 Service Pack 2' ok_(classifier._windows_action( raw_crash, raw_dumps, processed_crash, fake_processor )) eq_( processed_crash.classifications.support.classification, 'firefox-no-longer-works-some-versions-windows-xp' ) classifier = OutOfDateClassifier() classifier.out_of_date_threshold = ('17',) processed_crash.json_dump['system_info']['os'] = 'Windows NT' processed_crash.json_dump['system_info']['os_ver'] = \ '5.0 Service Pack 23' ok_(classifier._windows_action( raw_crash, raw_dumps, processed_crash, fake_processor )) eq_( processed_crash.classifications.support.classification, 'firefox-no-longer-works-windows-2000' ) classifier = OutOfDateClassifier() classifier.out_of_date_threshold = ('17',) processed_crash.json_dump['system_info']['os'] = 'Windows NT' processed_crash.json_dump['system_info']['os_ver'] = \ '5.1.2600 Service Pack 3' ok_(classifier._windows_action( raw_crash, raw_dumps, processed_crash, fake_processor )) eq_( processed_crash.classifications.support.classification, 'update-firefox-latest-version' )
def test_normalize_osx_version(self): classifier = OutOfDateClassifier() eq_( classifier._normalize_osx_version("10.4.5"), (10, 4) ) eq_( classifier._normalize_osx_version("10"), (10, ) ) eq_( classifier._normalize_osx_version( "10.dwight" ), (10, maxint) )
def test_normalize_windows_version(self): classifier = OutOfDateClassifier() eq_( classifier._normalize_windows_version("5.1.2600 Service Pack 3"), (5, 1, 3) ) eq_( classifier._normalize_windows_version("5.1.2600"), (5, 1) ) eq_( classifier._normalize_windows_version( "5.1.2600 Dwight Wilma" ), (5, 1) ) eq_( classifier._normalize_windows_version( "5" ), (5, ) )
def test_normalize_windows_version(self): classifier = OutOfDateClassifier() eq_(classifier._normalize_windows_version("5.1.2600 Service Pack 3"), (5, 1, 3)) eq_(classifier._normalize_windows_version("5.1.2600"), (5, 1)) eq_(classifier._normalize_windows_version("5.1.2600 Dwight Wilma"), (5, 1)) eq_(classifier._normalize_windows_version("5"), (5, ))
def test_action(self): jd = copy.deepcopy(cannonical_json_dump) processed_crash = DotDict() processed_crash.json_dump = jd raw_crash = DotDict() raw_crash.ProductName = 'Firefox' raw_crash.Version = '16' fake_processor = create_basic_fake_processor() classifier = OutOfDateClassifier() classifier.out_of_date_threshold = ('17',) processed_crash.json_dump['system_info']['os'] = 'Mac OS X' processed_crash.json_dump['system_info']['os_ver'] = '10.1' processed_crash.json_dump['system_info']['cpu_arch'] = 'ppc' self.assertTrue(classifier._action( raw_crash, processed_crash, fake_processor )) self.assertEqual( processed_crash.classifications.support.classification, 'firefox-no-longer-works-mac-os-10-4-or-powerpc' ) processed_crash.json_dump['system_info']['os'] = 'Windows NT' processed_crash.json_dump['system_info']['os_ver'] = \ '5.1.2600 Service Pack 3' self.assertTrue(classifier._action( raw_crash, processed_crash, fake_processor )) self.assertEqual( processed_crash.classifications.support.classification, 'update-firefox-latest-version' )
def test_osx_action(self): jd = copy.deepcopy(cannonical_json_dump) processed_crash = DotDict() processed_crash.json_dump = jd raw_crash = DotDict() raw_crash.ProductName = 'Firefox' raw_crash.Version = '16' raw_dumps = {} fake_processor = create_basic_fake_processor() classifier = OutOfDateClassifier() classifier.out_of_date_threshold = ('17',) processed_crash.json_dump['system_info']['os'] = 'Mac OS X' processed_crash.json_dump['system_info']['os_ver'] = '10.1' processed_crash.json_dump['system_info']['cpu_arch'] = 'ppc' ok_(classifier._osx_action( raw_crash, raw_dumps, processed_crash, fake_processor )) eq_( processed_crash.classifications.support.classification, 'firefox-no-longer-works-mac-os-10-4-or-powerpc' ) classifier = OutOfDateClassifier() classifier.out_of_date_threshold = ('17',) processed_crash.json_dump['system_info']['os'] = 'Mac OS X' processed_crash.json_dump['system_info']['os_ver'] = '10.5' processed_crash.json_dump['system_info']['cpu_arch'] = 'ppc' ok_(classifier._osx_action( raw_crash, raw_dumps, processed_crash, fake_processor )) eq_( processed_crash.classifications.support.classification, 'firefox-no-longer-works-mac-os-10-4-or-powerpc' ) classifier = OutOfDateClassifier() classifier.out_of_date_threshold = ('17',) processed_crash.json_dump['system_info']['os'] = 'Mac OS X' processed_crash.json_dump['system_info']['os_ver'] = '10.5' processed_crash.json_dump['system_info']['cpu_arch'] = 'x86' ok_(classifier._osx_action( raw_crash, raw_dumps, processed_crash, fake_processor )) eq_( processed_crash.classifications.support.classification, 'firefox-no-longer-works-mac-os-x-10-5' ) classifier = OutOfDateClassifier() classifier.out_of_date_threshold = ('17',) processed_crash.json_dump['system_info']['os'] = 'Mac OS X' processed_crash.json_dump['system_info']['os_ver'] = '10.99' ok_(classifier._osx_action( raw_crash, raw_dumps, processed_crash, fake_processor )) eq_( processed_crash.classifications.support.classification, 'update-firefox-latest-version' )
def test_windows_action(self): jd = copy.deepcopy(cannonical_json_dump) processed_crash = DotDict() processed_crash.json_dump = jd raw_crash = DotDict() raw_crash.ProductName = 'Firefox' raw_crash.Version = '16' fake_processor = create_basic_fake_processor() classifier = OutOfDateClassifier() classifier.out_of_date_threshold = ('17', ) processed_crash.json_dump['system_info']['os'] = 'Windows NT' processed_crash.json_dump['system_info']['os_ver'] = \ '5.1.2600 Service Pack 2' ok_( classifier._windows_action(raw_crash, processed_crash, fake_processor)) eq_(processed_crash.classifications.support.classification, 'firefox-no-longer-works-some-versions-windows-xp') classifier = OutOfDateClassifier() classifier.out_of_date_threshold = ('17', ) processed_crash.json_dump['system_info']['os'] = 'Windows NT' processed_crash.json_dump['system_info']['os_ver'] = \ '5.0 Service Pack 23' ok_( classifier._windows_action(raw_crash, processed_crash, fake_processor)) eq_(processed_crash.classifications.support.classification, 'firefox-no-longer-works-windows-2000') classifier = OutOfDateClassifier() classifier.out_of_date_threshold = ('17', ) processed_crash.json_dump['system_info']['os'] = 'Windows NT' processed_crash.json_dump['system_info']['os_ver'] = \ '5.1.2600 Service Pack 3' ok_( classifier._windows_action(raw_crash, processed_crash, fake_processor)) eq_(processed_crash.classifications.support.classification, 'update-firefox-latest-version')