Fix up vote tests in test_dir_handle_get.

These tests used a hardcoded vote with a hardcoded digest.  That
vote didn't have any pr lines, and so it is now invalid. I've
adjusted the testing code so that it mocks the signature-checking,
so that we can more easily change the contents of the vote.
This commit is contained in:
Nick Mathewson
2020-10-16 09:26:41 -04:00
parent 36ea25c236
commit acf4225441
4 changed files with 55 additions and 17 deletions
+3 -3
View File
@@ -139,13 +139,13 @@ signed_digest_equals, (const uint8_t *d1, const uint8_t *d2, size_t len))
* the document when generating log messages. Return 0 on success, negative
* on failure.
*/
int
check_signature_token(const char *digest,
MOCK_IMPL(int,
check_signature_token,(const char *digest,
ssize_t digest_len,
directory_token_t *tok,
crypto_pk_t *pkey,
int flags,
const char *doctype)
const char *doctype))
{
char *signed_digest;
size_t keysize;
+6 -6
View File
@@ -20,12 +20,12 @@ int router_get_hash_impl(const char *s, size_t s_len, char *digest,
#define CST_NO_CHECK_OBJTYPE (1<<0)
struct directory_token_t;
int check_signature_token(const char *digest,
ssize_t digest_len,
struct directory_token_t *tok,
crypto_pk_t *pkey,
int flags,
const char *doctype);
MOCK_DECL(int, check_signature_token,(const char *digest,
ssize_t digest_len,
struct directory_token_t *tok,
crypto_pk_t *pkey,
int flags,
const char *doctype));
int router_get_hash_impl_helper(const char *s, size_t s_len,
const char *start_str,