提交 c9ef3cd0 编写于 作者: A Anton Perkov

more checks in idenity test

上级 87fe731c
......@@ -317,7 +317,7 @@ namespace identity {
row.trusted = is_trusted( cert.certifier );
row.certifier = cert.certifier;
row.confidence = value.confidence;
assert(value.type.get_size() <= 32, "certrow::type shouldn't be longer than 32 bytes");
assert(value.type.get_size() <= 32, "certrow::type should be not longer than 32 bytes");
row.type = value.type;
row.data = value.data;
......
......@@ -278,6 +278,30 @@ BOOST_FIXTURE_TEST_CASE( certify_decertify, identity_tester ) try {
//shouldn't be able to certify without authorization
BOOST_REQUIRE_EQUAL(error("missing authority of bob"), certify("bob", identity_val, fields, false));
//certifying non-existent identity is not allowed
uint64_t non_existent = 11;
BOOST_REQUIRE_EQUAL(error("condition: assertion failed: identity does not exist"),
certify("alice", non_existent, vector<fc::variant>{ mutable_variant_object()
("property", "name")
("type", "string")
("data", to_uint8_vector("Alice Smith"))
("memo", "")
("confidence", 100)
})
);
//parameter "type" should be not longer than 32 bytes
BOOST_REQUIRE_EQUAL(error("condition: assertion failed: certrow::type should be not longer than 32 bytes"),
certify("alice", identity_val, vector<fc::variant>{ mutable_variant_object()
("property", "height")
("type", "super_long_type_name_wich_is_not_allowed")
("data", to_uint8_vector("Alice Smith"))
("memo", "")
("confidence", 100)
})
);
//bob also should be able to certify
BOOST_REQUIRE_EQUAL(success(), certify("bob", identity_val, fields));
obj = get_certrow(identity_val, "email", 0, "bob");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册