diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-02-15 18:11:25 +0100 |
---|---|---|
committer | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-02-27 14:52:10 +0100 |
commit | ad747ab62b006c0f54e62901f89330c1617f1d47 (patch) | |
tree | 6d80d1ccf45fd5fb67ec9cc5e87a4f238c2a944d /core | |
parent | 250084f8b913e326e20ccc60c86091beab0a6524 (diff) | |
download | nextcloud-server-ad747ab62b006c0f54e62901f89330c1617f1d47.tar.gz nextcloud-server-ad747ab62b006c0f54e62901f89330c1617f1d47.zip |
feat(settings): Migrate OCM / OCS provider tests to SetupCheck
Co-authored-by: Ferdinand Thiessen <opensource@fthiessen.de>
Co-authored-by: Joas Schilling <213943+nickvergessen@users.noreply.github.com>
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'core')
-rw-r--r-- | core/js/setupchecks.js | 41 | ||||
-rw-r--r-- | core/js/tests/specs/setupchecksSpec.js | 36 |
2 files changed, 0 insertions, 77 deletions
diff --git a/core/js/setupchecks.js b/core/js/setupchecks.js index be6dc747540..598fb541136 100644 --- a/core/js/setupchecks.js +++ b/core/js/setupchecks.js @@ -95,47 +95,6 @@ return deferred.promise(); }, - - /** - * Check whether the .well-known URLs works. - * - * @param url the URL to test - * @param placeholderUrl the placeholder URL - can be found at OC.theme.docPlaceholderUrl - * @param {boolean} runCheck if this is set to false the check is skipped and no error is returned - * - * @return $.Deferred object resolved with an array of error messages - */ - checkProviderUrl: function(url, placeholderUrl, runCheck) { - var expectedStatus = [200]; - var deferred = $.Deferred(); - - if(runCheck === false) { - deferred.resolve([]); - return deferred.promise(); - } - var afterCall = function(xhr) { - var messages = []; - if (expectedStatus.indexOf(xhr.status) === -1) { - var docUrl = placeholderUrl.replace('PLACEHOLDER', 'admin-nginx'); - messages.push({ - msg: t('core', 'Your web server is not properly set up to resolve "{url}". This is most likely related to a web server configuration that was not updated to deliver this folder directly. Please compare your configuration against the shipped rewrite rules in ".htaccess" for Apache or the provided one in the documentation for Nginx at it\'s {linkstart}documentation page ↗{linkend}. On Nginx those are typically the lines starting with "location ~" that need an update.', { docLink: docUrl, url: url }) - .replace('{linkstart}', '<a target="_blank" rel="noreferrer noopener" class="external" href="' + docUrl + '">') - .replace('{linkend}', '</a>'), - type: OC.SetupChecks.MESSAGE_TYPE_WARNING - }); - } - deferred.resolve(messages); - }; - - $.ajax({ - type: 'GET', - url: url, - complete: afterCall, - allowAuthErrors: true - }); - return deferred.promise(); - }, - /** * Runs setup checks on the server side * diff --git a/core/js/tests/specs/setupchecksSpec.js b/core/js/tests/specs/setupchecksSpec.js index 378bd4d7f39..0f042c19942 100644 --- a/core/js/tests/specs/setupchecksSpec.js +++ b/core/js/tests/specs/setupchecksSpec.js @@ -107,42 +107,6 @@ describe('OC.SetupChecks tests', function() { }); }); - describe('checkProviderUrl', function() { - it('should fail with another response status code than the expected one', function(done) { - var async = OC.SetupChecks.checkProviderUrl('/ocm-provider/', 'http://example.org/PLACEHOLDER', true); - - suite.server.requests[0].respond(302); - - async.done(function( data, s, x ){ - expect(data).toEqual([{ - msg: 'Your web server is not properly set up to resolve "/ocm-provider/". This is most likely related to a web server configuration that was not updated to deliver this folder directly. Please compare your configuration against the shipped rewrite rules in ".htaccess" for Apache or the provided one in the documentation for Nginx at it\'s <a target="_blank" rel="noreferrer noopener" class="external" href="http://example.org/admin-nginx">documentation page ↗</a>. On Nginx those are typically the lines starting with "location ~" that need an update.', - type: OC.SetupChecks.MESSAGE_TYPE_WARNING - }]); - done(); - }); - }); - - it('should return no error with the expected response status code', function(done) { - var async = OC.SetupChecks.checkProviderUrl('/ocm-provider/', 'http://example.org/PLACEHOLDER', true); - - suite.server.requests[0].respond(200); - - async.done(function( data, s, x ){ - expect(data).toEqual([]); - done(); - }); - }); - - it('should return no error when no check should be run', function(done) { - var async = OC.SetupChecks.checkProviderUrl('/ocm-provider/', 'http://example.org/PLACEHOLDER', false); - - async.done(function( data, s, x ){ - expect(data).toEqual([]); - done(); - }); - }); - }); - describe('checkDataProtected', function() { oc_dataURL = "data"; |