Skip to content

Commit

Permalink
pkp/pkp-lib#7366 test updated and update migration added
Browse files Browse the repository at this point in the history
  • Loading branch information
touhidurabir committed Aug 24, 2022
1 parent e039d64 commit deab530
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
21 changes: 18 additions & 3 deletions cypress/tests/integration/API.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,35 @@ describe('API tests', function() {
cy.get('.app__userNav button').click();
cy.get('a:contains("Edit Profile")').click();
cy.get('a[name="apiSettings"]').click();
cy.get('input[id="apiKeyEnabled"]').check();
cy.get('input[id="generateApiKey"]').check();
cy.get('form[id="apiProfileForm"] button:contains("Save")').click();
cy.get('form[id="apiProfileForm"] button:contains("Create API Key")').click();
cy.waitJQuery();
cy.get('span:contains("Your changes have been saved.")');
cy.get('input[id^="apiKey-"]').invoke('val').as('apiKey').then(function() {
cy.log(this.apiKey);
});
cy.logout();
});

it("Lists submissions using an author's API key", function() {
cy.request('index.php/publicknowledge/api/v1/submissions?apiToken=' + this.apiKey).then(response => {
// The author only has a single submission; submissions from other users should not be included.
expect(response.body.items.length).eq(1);
});
});

it("Delete an author's API key", function() {
cy.login('ccorino', null, 'publicknowledge');
cy.get('.app__userNav button').click();
cy.get('a:contains("Edit Profile")').click();
cy.get('a[name="apiSettings"]').click();
cy.get('form[id="apiProfileForm"] button:contains("Delete")').click();
cy.waitJQuery();
cy.on('window:confirm', (text) => {
return true;
});
cy.waitJQuery();
cy.get('span:contains("Your changes have been saved.")');
cy.get('input[id^="apiKey-"]').invoke('val').should('eq', 'None');
cy.logout();
});
})
1 change: 1 addition & 0 deletions dbscripts/xml/upgrade.xml
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@
<migration class="PKP\migration\upgrade\v3_4_0\I8151_ExtendSettingValues"/>
<migration class="PKP\migration\upgrade\v3_4_0\I2890_EmailTemplatesVarcharLengthUpdate"/>
<migration class="PKP\migration\upgrade\v3_4_0\I2890_AddSetNullForOnDeleteToReviewRoundIdForeign"/>
<migration class="PKP\migration\upgrade\v3_4_0\I7366_UpdateUserAPIKeySettings"/>
<data file="dbscripts/xml/upgrade/3.4.0_preupdate_email_templates.xml" />
<code function="installEmailTemplate" key="EDITOR_DECISION_NOTIFY_OTHER_AUTHORS" locales="en_US" />
<code function="installEmailTemplate" key="EDITOR_DECISION_NEW_ROUND" locales="en_US" />
Expand Down

0 comments on commit deab530

Please sign in to comment.