Exemplo n.º 1
0
    def test_get_asset_holders(self):
        lcc.set_step("Get all asset holders")
        self.get_holders()

        lcc.set_step("Get asset_id and count of holders")
        params = [self.resp_all_asset_holders["result"][0]["asset_id"], 0, 100]
        holders_count = self.resp_all_asset_holders["result"][0]["count"]
        lcc.log_info("Params = {}, holders count = {}".format(
            params, holders_count))

        lcc.set_step("Get list of holders")
        self.send_request(self.get_request(self.__get_asset_holders, params),
                          self.__identifier)
        self.__resp = self.get_response()

        lcc.set_step("Check names of holders in list of expected holders")
        for i in range(holders_count):
            expected_keys = ["name", "account_id", "amount"]
            for j in range(len(expected_keys)):
                check_that(
                    "'holder №{}'".format(i + 1),
                    self.__resp["result"][i],
                    has_entry(
                        expected_keys[j],
                        ((self.get_expected(self.__get_holders))[i])[j],
                    ),
                )
Exemplo n.º 2
0
def verify_get_users():
    response = requests.get(api_url + '/users',
                            headers={
                                'Authorization': 'token %s' % token,
                            })
    check_that("response code", response.status_code,
               equal_to(200))  # check if the response code is 200
    response_json = response.json()
Exemplo n.º 3
0
    def test_get_account_count(self):
        lcc.set_step("Get account count")
        self.send_request(self.get_request(self.__get_account_count),
                          self.__identifier)
        self.__resp = self.get_response()

        lcc.set_step("Check get account count")
        check_that("'account count'", self.__resp["result"], is_integer(29))
Exemplo n.º 4
0
    def test_get_witness_count(self):
        lcc.set_step("Get witness count")
        self.send_request(self.get_request(self.__get_witness_count),
                          self.__identifier)
        self.__resp = self.get_response()

        lcc.set_step("Check get witness count")
        check_that("'witness count'", self.__resp["result"], is_integer(1))
Exemplo n.º 5
0
    def test_login_with_empty_params(self):
        lcc.set_step("Login to Echo")
        self.send_request(self.get_request(self._login_api))
        self.__resp = self.get_response()

        lcc.set_step("Check response with empty data")
        check_that("'login status'", self.__resp["result"], is_bool())

        lcc.set_step("Check that login successful")
        self._login_status(self.__resp)
Exemplo n.º 6
0
    def test_login_with_valid_params(self):
        lcc.set_step("Login to the Full Node with valid params")
        self.send_request(self.get_request(self._login_api, self.get_expected(self.__login_valid_params)))
        self.__resp = self.get_response()

        lcc.set_step("Check response with valid data")
        check_that("'login status'", self.__resp["result"], is_bool())

        lcc.set_step("Check that login successful")
        self._login_status(self.__resp)
Exemplo n.º 7
0
    def test_get_all_asset_holders(self):
        lcc.set_step("Get all asset holders")
        self.get_holders()

        lcc.set_step("Check asset_id and count of all asset holders")
        check_that(
            "'contract result'",
            self.resp_all_asset_holders["result"],
            is_(self.get_expected(self.__get_all_asset_holders)),
        )
Exemplo n.º 8
0
    def test_get_relative_account_history(self):
        lcc.set_step("Get relative account history")
        self.send_request(self.get_request(self.__get_relative_account_history), self.__identifier)
        self.__resp = self.get_response()

        lcc.set_step("Check get relative account history")
        check_that(
            "'relative account history'",
            self.__resp["result"],
            is_list(self.get_expected(self.__get_relative_account_history)),
        )
Exemplo n.º 9
0
    def test_get_contract_history(self):
        lcc.set_step("Get contract history")
        self.send_request(self.get_request(self.__get_contract_history), self.__identifier)
        self.__resp = self.get_response()

        lcc.set_step("Check get contract history")
        check_that(
            "'contract history'",
            self.__resp["result"],
            is_(self.get_expected(self.__get_contract_history)),
        )
Exemplo n.º 10
0
    def test_get_account_history_operations(self):
        lcc.set_step("Get account history operations")
        self.send_request(self.get_request(self.__get_account_history_operations), self.__identifier)
        self.__resp = self.get_response()

        lcc.set_step("Check get account history operations")
        check_that(
            "'account history operations'",
            self.__resp["result"],
            is_(self.get_expected(self.__get_account_history_operations)),
        )
Exemplo n.º 11
0
    def test_get_global_properties(self):
        lcc.set_step("Get global properties")
        self.send_request(self.get_request(self.__get_global_properties),
                          self.__identifier)
        self.__resp = self.get_response()

        lcc.set_step("Check global properties info")
        check_that(
            "'global properties'",
            self.__resp["result"],
            is_dict(self.get_expected(self.__get_global_properties)),
        )
Exemplo n.º 12
0
    def test_get_config(self):
        lcc.set_step("Get config")
        self.send_request(self.get_request(self.__get_config),
                          self.__identifier)
        self.__resp = self.get_response()

        lcc.set_step("Check config info")
        check_that(
            "'config'",
            self.__resp["result"],
            is_dict(self.get_expected(self.__get_config)),
        )
Exemplo n.º 13
0
    def test_get_all_contracts(self):
        lcc.set_step("Get all contracts")
        self.send_request(self.get_request(self.__get_all_contracts),
                          self.__identifier)
        self.__resp = self.get_response()

        lcc.set_step("Check get all contracts")
        check_that(
            "'all contracts'",
            self.__resp["result"],
            is_(self.get_expected(self.__get_all_contracts)),
        )
Exemplo n.º 14
0
    def test_get_proposed_transactions(self):
        lcc.set_step("Get proposed transactions")
        self.send_request(self.get_request(self.__get_proposed_transactions, ),
                          self.__identifier)
        self.__resp = self.get_response()

        lcc.set_step("Check get proposed transactions")
        check_that(
            "'proposed transactions'",
            self.__resp["result"],
            is_(self.get_expected(self.__get_proposed_transactions)),
        )
Exemplo n.º 15
0
    def test_set_subscribe_callback(self):
        lcc.set_step("Set subscribe callback")
        self.send_request(self.get_request(self.__set_subscribe_callback),
                          self.__identifier)
        self.__resp = self.get_response()

        lcc.set_step("Check set subscribe callback")
        check_that(
            "'subscribe callback'",
            self.__resp["result"],
            is_none(),
        )
Exemplo n.º 16
0
    def test_get_account_by_name(self):
        lcc.set_step("Get account by name")
        self.send_request(self.get_request(self.__get_account_by_name),
                          self.__identifier)
        self.__resp = self.get_response()

        lcc.set_step("Check account by name")
        check_that(
            "'init2'",
            self.__resp["result"],
            is_dict(self.get_expected(self.__get_account_by_name)),
        )
Exemplo n.º 17
0
    def test_cancel_all_subscriptions(self):
        lcc.set_step("Cancel all subscriptions")
        self.send_request(self.get_request(self.__cancel_all_subscriptions),
                          self.__identifier)
        self.__resp = self.get_response()

        lcc.set_step("Cancel all subscriptions")
        check_that(
            "'cancel all subscriptions'",
            self.__resp["result"],
            is_none(),
        )
Exemplo n.º 18
0
    def test_get_workers_by_account(self):
        lcc.set_step("Get workers by account")
        self.send_request(self.get_request(self.__get_workers_by_account),
                          self.__identifier)
        self.__resp = self.get_response()

        lcc.set_step("Check get workers by account")
        check_that(
            "'workers by account'",
            self.__resp["result"],
            is_(self.get_expected(self.__get_workers_by_account)),
        )
Exemplo n.º 19
0
    def test_set_block_applied_callback(self):
        lcc.set_step("Set block applied callback")
        self.send_request(self.get_request(self.__set_block_applied_callback),
                          self.__identifier)
        self.__resp = self.get_response()

        lcc.set_step("Check set block applied callback")
        check_that(
            "'block applied callback'",
            self.__resp["result"],
            is_none(),
        )
Exemplo n.º 20
0
    def test_get_margin_positions(self):
        lcc.set_step("Get margin positions")
        self.send_request(self.get_request(self.__get_margin_positions),
                          self.__identifier)
        self.__resp = self.get_response()

        lcc.set_step("Check get margin positions")
        check_that(
            "'margin positions'",
            self.__resp["result"],
            is_(self.get_expected(self.__get_margin_positions)),
        )
Exemplo n.º 21
0
    def test_get_settle_orders(self):
        lcc.set_step("Get settle orders")
        self.send_request(self.get_request(self.__get_settle_orders),
                          self.__identifier)
        self.__resp = self.get_response()

        lcc.set_step("Check get settle orders")
        check_that(
            "'settle orders'",
            self.__resp["result"],
            is_(self.get_expected(self.__get_settle_orders)),
        )
Exemplo n.º 22
0
    def test_get_chain_id(self):
        lcc.set_step("Get chain id")
        self.send_request(self.get_request(self.__get_chain_id),
                          self.__identifier)
        self.__resp = self.get_response()

        lcc.set_step("Check chain id info")
        check_that(
            "'chain id'",
            self.__resp["result"],
            is_str(self.get_expected(self.__get_chain_id)),
        )
Exemplo n.º 23
0
    def test_lookup_account_names(self):
        lcc.set_step("Lookup account names")
        self.send_request(self.get_request(self.__lookup_account_names),
                          self.__identifier)
        self.__resp = self.get_response()

        lcc.set_step("Check lookup account names")
        check_that(
            "'lookup account names'",
            self.__resp["result"],
            is_list(self.get_expected(self.__lookup_account_names)),
        )
Exemplo n.º 24
0
    def test_get_transaction(self):
        lcc.set_step("Retrieve transaction")
        self.send_request(self.get_request(self.__get_transaction),
                          self.__identifier)
        self.__resp = self.get_response()

        lcc.set_step("Check transaction info")
        check_that(
            "'transaction info'",
            self.__resp["result"],
            is_dict(self.get_expected(self.__get_transaction)),
        )
Exemplo n.º 25
0
    def test_get_block_header(self):
        lcc.set_step("Retrieve header of signed block")
        self.send_request(self.get_request(self.__get_block_header),
                          self.__identifier)
        self.__resp = self.get_response()

        lcc.set_step("Check block header info")
        check_that(
            "'block header info'",
            self.__resp["result"],
            is_dict(self.get_expected(self.__get_block_header)),
        )
Exemplo n.º 26
0
    def test_lookup_vote_ids(self):
        lcc.set_step("Lookup vote ids")
        self.send_request(self.get_request(self.__lookup_vote_ids),
                          self.__identifier)
        self.__resp = self.get_response()

        lcc.set_step("Check lookup vote ids")
        check_that(
            "'lookup vote ids'",
            self.__resp["result"],
            is_list(self.get_expected(self.__lookup_vote_ids)),
        )
Exemplo n.º 27
0
    def test_get_objects(self):
        lcc.set_step("Get objects 'account' and 'asset'")
        self.send_request(self.get_request(self.__get_objects),
                          self.__identifier)
        self.__resp = self.get_response()

        lcc.set_step("Check get objects 'account' and 'asset'")
        check_that(
            "'account' and 'asset'",
            self.__resp["result"],
            is_list(self.get_expected(self.__get_objects)),
        )
Exemplo n.º 28
0
    def test_get_key_references(self):
        lcc.set_step("Get key references")
        self.send_request(self.get_request(self.__get_key_references),
                          self.__identifier)
        self.__resp = self.get_response()

        lcc.set_step("Check key references")
        check_that(
            "'key references'",
            self.__resp["result"],
            is_list(self.get_expected(self.__get_key_references)),
        )
Exemplo n.º 29
0
    def test_get_committee_members(self):
        lcc.set_step("Get committee members")
        self.send_request(self.get_request(self.__get_committee_members),
                          self.__identifier)
        self.__resp = self.get_response()

        lcc.set_step("Check get committee members")
        check_that(
            "'committee members'",
            self.__resp["result"],
            is_list(self.get_expected(self.__get_committee_members)),
        )
Exemplo n.º 30
0
    def test_get_contract_balances(self):
        lcc.set_step("Get contract balances")
        self.send_request(self.get_request(self.__get_contract_balances),
                          self.__identifier)
        self.__resp = self.get_response()

        lcc.set_step("Check get contract balances")
        check_that(
            "'contract balances'",
            self.__resp["result"],
            is_(self.get_expected(self.__get_contract_balances)),
        )