예제 #1
0
 def test_manifest_not_found_error(self, run_addons_linter_mock,
                                   parse_addon_mock):
     parse_addon_mock.side_effect = NoManifestFound(message='Fôo')
     # When parse_addon() raises a NoManifestFound error, we should
     # still call the linter to let it raise the appropriate error message.
     tasks.validate_file_path(get_addon_file('valid_webextension.xpi'),
                              channel=amo.RELEASE_CHANNEL_LISTED)
     assert run_addons_linter_mock.call_count == 1
예제 #2
0
 def test_validate_file_path_mocks(self, run_addons_linter_mock,
                                   parse_addon_mock,
                                   annotate_validation_results_mock):
     parse_addon_mock.return_value = mock.Mock()
     run_addons_linter_mock.return_value = {'fake_results': True}
     tasks.validate_file_path(
         get_addon_file('webextension.xpi'),
         channel=amo.RELEASE_CHANNEL_UNLISTED,
     )
     assert parse_addon_mock.call_count == 1
     assert run_addons_linter_mock.call_count == 1
     assert annotate_validation_results_mock.call_count == 1
     annotate_validation_results_mock.assert_called_with(
         run_addons_linter_mock.return_value, parse_addon_mock.return_value)
예제 #3
0
 def test_amo_validator_fail_error(self):
     result = tasks.validate_file_path(
         get_addon_file('invalid_firefox_addon_error.xpi'),
         hash_=None, listed=True)
     assert not result['success']
     assert result['errors']
     assert not result['warnings']
예제 #4
0
 def test_amo_validator_addons_linter_success(self):
     result = tasks.validate_file_path(
         get_addon_file('valid_webextension.xpi'),
         hash_=None, listed=True, is_webextension=True)
     assert result['success']
     assert not result['errors']
     assert not result['warnings']
예제 #5
0
 def test_amo_validator_addons_linter_success(self):
     result = tasks.validate_file_path(
         get_addon_file('valid_webextension.xpi'),
         hash_=None, listed=True, is_webextension=True)
     assert result['success']
     assert not result['errors']
     assert not result['warnings']
예제 #6
0
 def test_fail_error(self):
     result = json.loads(tasks.validate_file_path(
         get_addon_file('invalid_webextension_invalid_id.xpi'),
         channel=amo.RELEASE_CHANNEL_LISTED))
     assert not result['success']
     assert result['errors']
     assert not result['warnings']
예제 #7
0
    def test_returns_skeleton_for_search_plugin(self):
        result = tasks.validate_file_path(
            None, get_addon_file('searchgeek-20090701.xml'),
            channel=amo.RELEASE_CHANNEL_LISTED)

        expected = amo.VALIDATOR_SKELETON_RESULTS
        assert result == expected
예제 #8
0
 def test_fail_warning(self):
     result = tasks.validate_file_path(
         None, get_addon_file('valid_webextension_warning.xpi'),
         channel=amo.RELEASE_CHANNEL_LISTED)
     assert result['success']
     assert not result['errors']
     assert result['warnings']
예제 #9
0
 def test_amo_validator_addons_linter_error(self):
     # This test assumes that `amo-validator` doesn't correctly
     # validate a invalid id in manifest.json
     result = tasks.validate_file_path(
         get_addon_file('invalid_webextension_invalid_id.xpi'),
         hash_=None, listed=True, is_webextension=True)
     assert not result['success']
     assert result['errors']
     assert not result['warnings']
예제 #10
0
 def test_amo_validator_addons_linter_error(self):
     # This test assumes that `amo-validator` doesn't correctly
     # validate a invalid id in manifest.json
     result = tasks.validate_file_path(
         get_addon_file('invalid_webextension_invalid_id.xpi'),
         hash_=None, listed=True, is_webextension=True)
     assert not result['success']
     assert result['errors']
     assert not result['warnings']