Skip to content

Commit

Permalink
Add more positive integration test for testing
Browse files Browse the repository at this point in the history
different date formats.
  • Loading branch information
abdulla-ashurov committed Jun 19, 2023
1 parent 04653b6 commit 0ac0fb2
Showing 1 changed file with 127 additions and 1 deletion.
128 changes: 127 additions & 1 deletion tests/integration/rest/diddoc/query/version_time/positive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,132 @@ var _ = DescribeTable("Positive: Get DIDDoc with versionTime query", func(testCa
},
),

Entry(
"can get DIDDoc with versionTime query parameter (Layout format)",
utils.PositiveTestCase{
DidURL: fmt.Sprintf(
"http://localhost:8080/1.0/identifiers/%s?versionTime=%s",
testconstants.SeveralVersionsDID,
url.QueryEscape("03/06 09:39:50AM '23 +0000"),
),
ResolutionType: testconstants.DefaultResolutionType,
ExpectedJSONPath: "../../../testdata/query/version_time/diddoc_version_time_did.json",
ExpectedStatusCode: http.StatusOK,
},
),

Entry(
"can get DIDDoc with versionTime query parameter (ANSIC format)",
utils.PositiveTestCase{
DidURL: fmt.Sprintf(
"http://localhost:8080/1.0/identifiers/%s?versionTime=%s",
testconstants.SeveralVersionsDID,
url.QueryEscape("Mon Mar 06 09:39:50 2023"),
),
ResolutionType: testconstants.DefaultResolutionType,
ExpectedJSONPath: "../../../testdata/query/version_time/diddoc_version_time_did.json",
ExpectedStatusCode: http.StatusOK,
},
),

Entry(
"can get DIDDoc with versionTime query parameter (UnixDate format)",
utils.PositiveTestCase{
DidURL: fmt.Sprintf(
"http://localhost:8080/1.0/identifiers/%s?versionTime=%s",
testconstants.SeveralVersionsDID,
url.QueryEscape("Mon Mar 06 09:39:50 UTC 2023"),
),
ResolutionType: testconstants.DefaultResolutionType,
ExpectedJSONPath: "../../../testdata/query/version_time/diddoc_version_time_did.json",
ExpectedStatusCode: http.StatusOK,
},
),

Entry(
"can get DIDDoc with versionTime query parameter (RubyDate format)",
utils.PositiveTestCase{
DidURL: fmt.Sprintf(
"http://localhost:8080/1.0/identifiers/%s?versionTime=%s",
testconstants.SeveralVersionsDID,
url.QueryEscape("Mon Mar 06 09:39:50 +0000 2023"),
),
ResolutionType: testconstants.DefaultResolutionType,
ExpectedJSONPath: "../../../testdata/query/version_time/diddoc_version_time_did.json",
ExpectedStatusCode: http.StatusOK,
},
),

Entry(
"can get DIDDoc with versionTime query parameter (RFC822 format)",
utils.PositiveTestCase{
DidURL: fmt.Sprintf(
"http://localhost:8080/1.0/identifiers/%s?versionTime=%s",
testconstants.SeveralVersionsDID,
url.QueryEscape("06 Mar 23 09:40 UTC"),
),
ResolutionType: testconstants.DefaultResolutionType,
ExpectedJSONPath: "../../../testdata/query/version_time/diddoc_version_time_did.json",
ExpectedStatusCode: http.StatusOK,
},
),

Entry(
"can get DIDDoc with versionTime query parameter (RFC822Z format)",
utils.PositiveTestCase{
DidURL: fmt.Sprintf(
"http://localhost:8080/1.0/identifiers/%s?versionTime=%s",
testconstants.SeveralVersionsDID,
url.QueryEscape("06 Mar 23 09:40 +0000"),
),
ResolutionType: testconstants.DefaultResolutionType,
ExpectedJSONPath: "../../../testdata/query/version_time/diddoc_version_time_did.json",
ExpectedStatusCode: http.StatusOK,
},
),

Entry(
"can get DIDDoc with versionTime query parameter (RFC850 format)",
utils.PositiveTestCase{
DidURL: fmt.Sprintf(
"http://localhost:8080/1.0/identifiers/%s?versionTime=%s",
testconstants.SeveralVersionsDID,
url.QueryEscape("Monday, 06-Mar-23 09:39:50 UTC"),
),
ResolutionType: testconstants.DefaultResolutionType,
ExpectedJSONPath: "../../../testdata/query/version_time/diddoc_version_time_did.json",
ExpectedStatusCode: http.StatusOK,
},
),

Entry(
"can get DIDDoc with versionTime query parameter (RFC1123 format)",
utils.PositiveTestCase{
DidURL: fmt.Sprintf(
"http://localhost:8080/1.0/identifiers/%s?versionTime=%s",
testconstants.SeveralVersionsDID,
url.QueryEscape("Mon, 06 Mar 2023 09:39:50 UTC"),
),
ResolutionType: testconstants.DefaultResolutionType,
ExpectedJSONPath: "../../../testdata/query/version_time/diddoc_version_time_did.json",
ExpectedStatusCode: http.StatusOK,
},
),

Entry(
"can get DIDDoc with versionTime query parameter (RFC1123Z format)",
utils.PositiveTestCase{
DidURL: fmt.Sprintf(
"http://localhost:8080/1.0/identifiers/%s?versionTime=%s",
testconstants.SeveralVersionsDID,
url.QueryEscape("Mon, 06 Mar 2023 09:39:50 +0000"),
),
ResolutionType: testconstants.DefaultResolutionType,
ExpectedJSONPath: "../../../testdata/query/version_time/diddoc_version_time_did.json",
ExpectedStatusCode: http.StatusOK,
},
),

Entry(
"can get DIDDoc with versionTime query parameter (RFC3339 format)",
utils.PositiveTestCase{
Expand Down Expand Up @@ -96,7 +222,7 @@ var _ = DescribeTable("Positive: Get DIDDoc with versionTime query", func(testCa
DidURL: fmt.Sprintf(
"http://localhost:8080/1.0/identifiers/%s?versionTime=%s",
testconstants.SeveralVersionsDID,
"2023-03-06"+url.PathEscape(testconstants.Space)+"09:39:50",
url.QueryEscape("2023-03-06 09:39:50"),
),
ResolutionType: testconstants.DefaultResolutionType,
ExpectedJSONPath: "../../../testdata/query/version_time/diddoc_version_time_did.json",
Expand Down

0 comments on commit 0ac0fb2

Please sign in to comment.