Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tests-Only] Adds API tests for counting number of etag elements in response of a versioned file #38439

Merged
merged 1 commit into from
Feb 26, 2021

Conversation

SwikritiT
Copy link
Contributor

@SwikritiT SwikritiT commented Feb 23, 2021

Description

Adds API tests for counting number of etag elements in response of a versioned file

Related Issue

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Database schema changes (next release will require increase of minor version instead of patch)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:
  • Changelog item, see TEMPLATE

And user "Alice" has uploaded file with content "version 2" to "textfile0.txt"
When user "Alice" gets the number of versions of file "textfile0.txt"
Then the HTTP status code should be "207"
And the number of etag element in the response should be "2"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, check the number of d:getlastmodified tags as you have specified in the scenario title.

When user "Alice" gets the number of versions of file "textfile0.txt"
Then the HTTP status code should be "207"
And the number of etag element in the response should be "2"
And the number of versions should be "2"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Talank this checks the version by counting d:getlastmodified so I thought that wouldn't be necessary. Maybe I should rephrase the scenario title.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That works, I suppose.

@@ -448,6 +448,31 @@ public function theNumberOfVersionsShouldBe($number) {
);
}

/**
* @Then the number of etag element in the response should be :arg1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @Then the number of etag element in the response should be :arg1
* @Then the number of etag element in the response should be :number

If you wish you can change it to something meaningful like this
else LGTM 👍

Copy link
Contributor

@Talank Talank left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -448,6 +448,31 @@ public function theNumberOfVersionsShouldBe($number) {
);
}

/**
* @Then the number of etag element in the response should be :number
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @Then the number of etag element in the response should be :number
* @Then the number of etag elements in the response should be :number

Assert::assertEquals(
$number,
$actualNumber,
"Expected number of etag element was '$number', but got '$actualNumber'"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"Expected number of etag element was '$number', but got '$actualNumber'"
"Expected number of etag elements was '$number', but got '$actualNumber'"

@sonarcloud
Copy link

sonarcloud bot commented Feb 26, 2021

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@Talank Talank merged commit 2315ca9 into master Feb 26, 2021
@delete-merged-branch delete-merged-branch bot deleted the versionCount branch February 26, 2021 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants