Skip to content

Commit

Permalink
[SPT-777] The method of rounding numbers has been replaced. Also upda…
Browse files Browse the repository at this point in the history
…ted claim logic was refactored
  • Loading branch information
MorozovMisha committed Feb 5, 2025
1 parent 9ef15cc commit a941076
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions snet/cli/test/functional_tests/func_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import shutil
import os
import importlib.util
import math

from snet.cli.commands.commands import BlockchainCommand

Expand Down Expand Up @@ -73,14 +74,18 @@ def test_3_set_network_sepolia(self):
assert "network: sepolia" in result

def test_4_network_create(self):
result = execute(["network", "create"])
execute(["network", "create", self.new_network, INFURA], self.parser, self.conf)
execute(["network", self.new_network], self.parser, self.conf)
result = execute(["session"], self.parser, self.conf)
execute(["network", "sepolia"], self.parser, self.conf)
assert self.new_network in result

def test_4_set_infura(self):
def test_5_set_infura(self):
execute(["set", "default_eth_rpc_endpoint", INFURA], self.parser, self.conf)
result = execute(["session"], self.parser, self.conf)
assert INFURA_KEY in result

def test_5_print_account(self):
def test_6_print_account(self):
result = execute(["account", "print"], self.parser, self.conf)
print(result)
assert ADDR in result
Expand Down Expand Up @@ -121,16 +126,15 @@ def test_deposit(self):
execute(["account", "deposit", f"{self.amount}", "-y", "-q"], self.parser, self.conf)
result = execute(["account", "balance"], self.parser, self.conf)
self.balance_2 = float(result.split("\n")[3].split()[1])
assert round(self.balance_2, 2) == round(self.balance_1, 2) + self.amount
assert math.isclose(self.balance_2, self.balance_1 + self.amount, rel_tol=1e-3)

def test_withdraw(self):
result = execute(["account", "balance"], self.parser, self.conf)
self.balance_1 = float(result.split("\n")[3].split()[1])
execute(["account", "withdraw", f"{self.amount}", "-y", "-q"], self.parser, self.conf)
result = execute(["account", "balance"], self.parser, self.conf)
self.balance_2 = float(result.split("\n")[3].split()[1])
print(f"{round(self.balance_2, 2)} == {round(self.balance_1, 2)} - {self.amount}")
assert round(self.balance_2, 2) == round(self.balance_1, 2) - self.amount
assert math.isclose(self.balance_2, self.balance_1 - self.amount, rel_tol=1e-3)

def test_transfer(self):
result = execute(["account", "transfer", ADDR, f"{self.amount}", "-y"], self.parser, self.conf)
Expand Down Expand Up @@ -411,6 +415,8 @@ def test_0_preparation(self):
}""")
proto_file.close()
result = execute(["session"], self.parser, self.conf)
hero_image = open("img.jpg", "w+")
hero_image.close()
assert "network: sepolia" in result

def test_1_metadata_init(self):
Expand Down Expand Up @@ -464,8 +470,6 @@ def test_5_change_members(self):
assert "event: OrganizationModified" in result_rem

def test_61_change_org_metadata(self):
hero_image = open("img.jpg", "w+")
hero_image.close()
execute(["organization", "metadata-add-assets", self.hero_image, "hero_image"], self.parser, self.conf)
execute(["organization", "metadata-remove-assets", "hero_image"], self.parser, self.conf)
execute(["organization", "metadata-remove-all-assets"], self.parser, self.conf)
Expand Down

0 comments on commit a941076

Please sign in to comment.