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: add test for special http headers, closes #651 #657

Merged
merged 1 commit into from
Sep 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions pytest_tests/testsuites/services/http_gate/test_http_gate.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import json
import logging
import os

import allure
import pytest
from cluster import Cluster
from epoch import get_epoch, tick_epoch
from file_helper import generate_file, generate_file_with_content, get_file_hash
from python_keywords.container import create_container
Expand Down Expand Up @@ -225,6 +227,36 @@ def test_put_http_get_http_with_multipart_content_type(self):
resp = get_via_http_gate(cid=cid, oid=oid, endpoint=self.cluster.default_http_gate_endpoint, return_response=True)
assert resp.headers['Content-Type'] == 'application/json'

@allure.title("Verify special HTTP headers")
def test_put_http_get_http_special_attributes(self, simple_object_size, cluster: Cluster):
cid = create_container(
self.wallet,
shell=self.shell,
endpoint=self.cluster.default_rpc_endpoint,
rule=self.PLACEMENT_RULE_2,
basic_acl=PUBLIC_ACL,
)

file_path = generate_file(simple_object_size)

oid = upload_via_http_gate(
cid=cid,
path=file_path,
endpoint=self.cluster.default_http_gate_endpoint,
)
resp = get_via_http_gate(
cid=cid,
oid=oid,
endpoint=self.cluster.default_http_gate_endpoint,
return_response=True
)
with open(cluster.http_gates[0].get_wallet_path()) as wallet_file:
wallet_json = json.load(wallet_file)

assert resp.headers['X-Owner-Id'] == wallet_json['accounts'][0]['address']
assert resp.headers['X-Object-Id'] == oid
assert resp.headers['X-Container-Id'] == cid

@allure.link("https://github.com/nspcc-dev/neofs-http-gw#uploading", name="uploading")
@allure.link("https://github.com/nspcc-dev/neofs-http-gw#downloading", name="downloading")
@allure.title("Test Put over HTTP, Get over HTTP")
Expand Down
Loading