Urgent.News

What's breaking now, across thousands of outlets.

Tech

Some quick thoughts on Unit Testing ActivityPub

I'm brutally honest when discussing Test Driven Development - I'm more inclined to telnet into production and accept consequences. The core concept of unit testing is straightforward: feed it good data, expect a true response, and vice versa for bad data. While working on ActivityBot as part of my NLnet-funded project, I'm creating thorough tests for the bot framework, hopeful that they'll prove useful to other similar projects.

Writing tests involves addressing four major classes of issues. To validate an ActivityPub username, we must consider assumptions about its structure: it starts with an @, contains another @, separating user and server parts, the server must be a valid domain name (including non-ASCII Internationalised Domain Names and Emoji domains), and the user part can include various characters. Discovering specifications for these components is challenging.

WebFinger responses, mandatory parts, and the values they can contain also pose questions. Ensuring other ActivityPub servers comprehend messages generated by your project is crucial. Similarly, deciphering follow messages from external servers is a concern. JSON Schemas aid in validating some message types, but scattered specifications complicate the process.

HTTP Signatures present two main challenges: verifying signatures, which requires gathering and replaying signatures, and generating signatures, where only one real method exists for acceptance testing. Effective communication between servers is vital; sending a signed request should be simple and repeatable. However, receiving messages isn't easily automated, demanding control over external servers to send messages, which is feasible with public servers like Mastodon but not always the case.

Written by urgent.news from Lobsters's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at shkspr.mobi →

More in Tech

Estimating moving costs without an address form: building a privacy-first quote calculator

Most moving quote tools start the same way: enter your name, email, phone, current address, destination address — and then the calls begin. We built ours backwards.

  • Fast Movers' quote calculator doesn't require personal data like name, email, or addresses
  • Cost estimation relies on distance, shipment weight, and season, not user accounts
  • Tool shows price ranges and assumptions to build trust and transparency

More from Saturday 17 October →