def test_Result(time_mock): ''' A standard Result should not be convertible to a string because Result.type is not implemented. ''' time_mock.side_effect = monotonic_time() fp1 = 'A' * 40 fp2 = 'Z' * 40 circ = [fp1, fp2] dest_url = 'http://example.com/sbws.bin' scanner_nick = 'sbwsscanner' nick = 'Mooooooo' relay_ip = '169.254.100.1' relay = Result.Relay(fp1, nick, relay_ip) r = Result(relay, circ, dest_url, scanner_nick) try: str(r) except NotImplementedError: pass else: assert None, 'Should have failed'
BW = 600000 UNMEASURED = False RELAY1 = Result.Relay(FP1, NICK1, IP1, ED25519, average_bandwidth=AVG_BW, burst_bandwidth=BUR_BW, observed_bandwidth=OBS_BW, consensus_bandwidth=BW, consensus_bandwidth_is_unmeasured=UNMEASURED, relay_in_recent_consensus_count=2) RELAY2 = Result.Relay(FP2, NICK2, IP2, ED25519) RESULT = Result(RELAY1, CIRC12, DEST_URL, SCANNER, t=TIME1) RESULT_SUCCESS1 = ResultSuccess(RTTS1, DOWNLOADS1, RELAY1, CIRC12, DEST_URL, SCANNER, t=TIME1) RESULT_SUCCESS2 = ResultSuccess(RTTS2, DOWNLOADS2, RELAY2, CIRC21, DEST_URL, SCANNER, t=TIME2) RESULT_ERROR_STREAM = ResultErrorStream(RELAY1,