Skip to content

Commit

Permalink
Fix : Clear test
Browse files Browse the repository at this point in the history
  • Loading branch information
1yam committed Aug 21, 2023
1 parent fa1e5cf commit 982376b
Showing 1 changed file with 2 additions and 34 deletions.
36 changes: 2 additions & 34 deletions tests/api/test_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,20 +118,7 @@ async def add_file_with_message(
file_content: bytes,
expected_file_hash: str,
):

data = {
"item_hash": "bb6e53f2738e5934b9a2125a9dc3d76211720e5152bdbcd4b236363d18d4f8a3",
"type": "STORE",
"chain": "ETH",
"sender": "0x696879aE4F6d8DaDD5b8F1cbb1e663B89b08f106",
"item_content":'{"address": "0x696879aE4F6d8DaDD5b8F1cbb1e663B89b08f106", "time": 1665478676.6585264, "item_type": "storage", "item_hash": "2086c8b69830df060f49bdf03a89e508688db7f5e5387bb875a6a0ed2d7a1d63", "mime_type": "text/plain"}',
"signature": "0xb9d164e6e43a8fcd341abc01eda47bed0333eaf480e888f2ed2ae0017048939d18850a33352e7281645e95e8673bad733499b6a8ce4069b9da9b9a79ddc1a0b31b",
"item_type": ItemType.storage,
"time": str(1616021679.055),
"channel": "TEST",
"trusted": "True",
}
test = {
"chain": "ETH",
"sender": "0x6dA130FD646f826C1b8080C07448923DF9a79aaA",
"type": "STORE",
Expand All @@ -149,35 +136,16 @@ async def add_file_with_message(
"mime_type": "text/plain"
},
}
data["time"] = str(data["time"])

json_data = json.dumps(test)
json_data = json.dumps(data)
form_data = aiohttp.FormData()
actual_item_hash = sha256(file_content).hexdigest()

form_data.add_field("file", file_content)
form_data.add_field("message", json_data, content_type='application/json')
form_data.add_field("size", str(len(file_content)))
post_response = await api_client.post(uri, data=form_data)
assert post_response.status == 200, await post_response.text()
#post_response_json = await post_response.json()
# data["time"] = 1644409598.782
# pending_message = PendingMessageDb.from_message_dict(
# data, fetched=True, reception_time=dt.datetime(2022, 1, 1)

def test_storage_add_file_with_message_only_parse():
message_dict = {
"chain": "ETH",
"item_hash": "30cc40533aa3ccf16a7c7c8a40da5633f64a83e4b89dcc7815f3a0af2149e1ac",
"sender": "0x7332eA1229c11C627C10eB24c1A6F77BceD1D5c1",
"type": "STORE",
"channel": "EVIDENZ",
"item_content": None,
"item_type": "storage",
"signature": "23d1d099dd111ae3251efea537f57767cf43b2ae3611bf9051760e0a9bc2bd4429563a130e3e391668086d101f8a197f55377f50b15d4c0303ff957d90a258a31b",
"time": 1616021679.055,
}

message = parse_message(message_dict)


@pytest.mark.asyncio
Expand Down

0 comments on commit 982376b

Please sign in to comment.