Skip to content

Commit

Permalink
test case for etag (#2790)
Browse files Browse the repository at this point in the history
* add test for etag

* format
  • Loading branch information
msyyc authored Sep 9, 2024
1 parent 9cac616 commit 9600df1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# license information.
# --------------------------------------------------------------------------
import pytest
import datetime
from specialheaders.conditionalrequest.aio import ConditionalRequestClient


Expand All @@ -21,3 +22,17 @@ async def test_post_if_match(core_library, client: ConditionalRequestClient):
@pytest.mark.asyncio
async def test_post_if_none_match(core_library, client: ConditionalRequestClient):
await client.post_if_none_match(etag="invalid", match_condition=core_library.MatchConditions.IfModified)


@pytest.mark.asyncio
async def test_head_if_modified_since(client: ConditionalRequestClient):
await client.head_if_modified_since(
if_modified_since=datetime.datetime(2022, 8, 26, 14, 38, 0, tzinfo=datetime.timezone.utc)
)


@pytest.mark.asyncio
async def test_post_if_unmodified_since(client: ConditionalRequestClient):
await client.post_if_unmodified_since(
if_unmodified_since=datetime.datetime(2022, 8, 26, 14, 38, 0, tzinfo=datetime.timezone.utc)
)
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# license information.
# --------------------------------------------------------------------------
import pytest
import datetime
from specialheaders.conditionalrequest import ConditionalRequestClient


Expand All @@ -19,3 +20,15 @@ def test_post_if_match(core_library, client: ConditionalRequestClient):

def test_post_if_none_match(core_library, client: ConditionalRequestClient):
client.post_if_none_match(etag="invalid", match_condition=core_library.MatchConditions.IfModified)


def test_head_if_modified_since(client: ConditionalRequestClient):
client.head_if_modified_since(
if_modified_since=datetime.datetime(2022, 8, 26, 14, 38, 0, tzinfo=datetime.timezone.utc)
)


def test_post_if_unmodified_since(client: ConditionalRequestClient):
client.post_if_unmodified_since(
if_unmodified_since=datetime.datetime(2022, 8, 26, 14, 38, 0, tzinfo=datetime.timezone.utc)
)

0 comments on commit 9600df1

Please sign in to comment.