Example #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
Example #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)
Example #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']
Example #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']
Example #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']
 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']
    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
 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']
Example #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']
Example #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']