Wykres commitów

1259 Commity (main)

Autor SHA1 Wiadomość Data
Marnanel Thurman af479642df Tests for previous commit (not checked in by error). 2020-08-27 15:42:18 +01:00
Marnanel Thurman 5ba53dfbb2 The MIME type of JPEGs serialised to ActivityPub was misspelled as "image/jpg" (instead of "image/jpeg"). Fixed.
Tests updated.
2020-08-27 15:35:06 +01:00
Marnanel Thurman b0aa91da76 ActivityPub representation for Persons has the publicKey field
being an object, not a string. This was a regression.

Tests updated. Thanks to vpzom for catching this.

Also, the same representation's "endpoints" object is now generated
on the fly. This means that changes to the TESTSERVER variable
during testing are correctly represented.
2020-08-27 15:25:54 +01:00
Marnanel Thurman 7368f2c372 serializers.py header 2020-08-25 15:50:25 +01:00
Marnanel Thurman bb2a5b48fb "sharedInbox" returns the shared inbox URL and not a user's outbox URL! 2020-08-25 15:21:48 +01:00
Marnanel Thurman 0ab9fecea4 suppress_thread_exceptions doesn't fail under Python 3.6.
It uses threading.excepthook, which doesn't exist in pre-3.8 Python. But there's no need to break all the tests under 3.6.

suppress_thread_exceptions was introduced in commit 001698cd.
2020-08-24 19:16:03 +01:00
Marnanel Thurman a6e80e1de6 Person.lookup() removed because it duplicates the functionality of fetch().
There is one difference, which I think isn't important in the circumstances.
If lookup() is asked about a remote person that we don't already know about,
it either creates a blank record for them and returns it, or raises an error.
In these circumstances, fetch() will perform a lookup and populate the record
accordingly.
2020-08-23 18:10:50 +01:00
Marnanel Thurman f4d05bba40 Cleaning up header blocks, and making sure we use getLogger instead of creating a new one in each module 2020-08-23 17:40:54 +01:00
Marnanel Thurman 68a1c3c8ac Add tophat_ui, which currently gives us a simple root page and no more. 2020-08-23 17:32:42 +01:00
Marnanel Thurman 4d7d0c7754 rm bowler_pub/views/README.md because it was out of date and misleading 2020-08-23 17:17:05 +01:00
Marnanel Thurman e1cb0208db A user's home timeline contains *all* posts of theirs, not just public and private ones
All trilby tests now pass
2020-08-23 17:13:01 +01:00
Marnanel Thurman 8d0eea8e75 some extra logging in views and models of trilby 2020-08-23 17:09:42 +01:00
Marnanel Thurman b42887616e Fix some of the headers in trilby.
Standard comment block at the start, and getting the logger in the same way.
2020-08-23 16:54:43 +01:00
Marnanel Thurman a4fa15e825 The Mastodon response to in_reply_to_account_id defaults to None.
This fixes a test failure.
2020-08-23 16:40:49 +01:00
Marnanel Thurman ad34290cf2 If create() is asked to Create something, the type of the new object is case-insensitive. 2020-08-23 00:19:38 +01:00
Marnanel Thurman f0d9a7203e create(), when asked to look up something atstyle, checks that it's a Person.
Previously this always failed because 1) "isinstance" was typoed as "isintance" and 2) "issubclass" was what was needed anyway.

Test now passes.
2020-08-23 00:18:18 +01:00
Marnanel Thurman 33555806e8 The great types in trilby_api, Person and Status, now have
local_form() and remote_form() class methods. This is to
allow fetch() to check whether something is already cached
before fetching it.

LocalPerson also gains a status() method for symmetry with
RemotePerson; it always returns 200.

Tests updated.
2020-08-22 22:26:22 +01:00
Marnanel Thurman d835a9bd83 "Create" messages require the object being created to have a type we can actually use.
This regressed in commit a2a790f1. Before then, handlers could be defined for particular object types.
When we moved to general-case handlers for each Activity type, we should have added object type checks
to replace the checks implicit in the type-specific handlers.
2020-08-21 23:45:42 +01:00
Marnanel Thurman 623041ba49 fix debug messages 2020-08-21 23:41:54 +01:00
Marnanel Thurman a2a790f18f fetch() handlers simplified; on_announce now works
fetch() used to allow handlers to specialise for Activity and object type,
like on_announce_note. But we don't always know the type of the
"object" field when we receive it, because we might only have its
address. Therefore, handlers can now only be named by the Activity.

on_announce now passes the simple tests.
2020-08-20 18:01:26 +01:00
Marnanel Thurman ecbba37661 bowler's StatusView now has an activity_get method. 2020-08-20 18:00:35 +01:00
Marnanel Thurman ccdc414ad8 Undoing the AcObject changes introduced in e9d780d2.
The changes would require multiple inheritance, which
PolymorphicModel doesn't support.
2020-08-20 16:36:40 +01:00
Marnanel Thurman 39154b1450 bowler's views rejigged, and obsolete code removed. Views tests now pass. 2020-08-15 19:16:36 +01:00
Marnanel Thurman e9d780d2a3 trilby's Status and Person classes now descend from a common ancestor,
AcObject. This allows bowler to return objects it finds without having
to require a particular type.
2020-08-15 18:51:59 +01:00
Marnanel Thurman 4bf78f6c37 updating tests to use fetch() instead of fetch_user() 2020-08-06 23:07:45 +01:00
Marnanel Thurman 1278fca221 test_expected_localtype() was reversed in sense; fixed 2020-08-06 23:00:57 +01:00
Marnanel Thurman 404e418a26 fetch() checks return type for local urls 2020-08-06 23:00:32 +01:00
Marnanel Thurman 99cff55897 fetch() implemented for local URLs. The views haven't yet been adapted,
so the tests still fail.

Much of this code was adapted from old stuff in the bowler-heavy branch.
2020-08-06 19:42:57 +01:00
Marnanel Thurman af9541233d fetch() -- local by atstyle. Local by url still to be implemented. 2020-08-06 19:30:31 +01:00
Marnanel Thurman 37241441a9 test_fetch errors fixed-- missing import & formal param name 2020-08-06 19:14:27 +01:00
Marnanel Thurman 9efa1fafda Added tests for localhost fetch(); they all fail at present because it isn't implemented yet 2020-08-05 17:02:29 +01:00
Marnanel Thurman 824fad0ba9 docstring for fetch() 2020-08-05 15:49:42 +01:00
Marnanel Thurman a26e26e946 moving _parse_address() down beneath fetch() so fetch() is at the top of the file 2020-08-05 15:34:02 +01:00
Marnanel Thurman da12b10a47 Major refactor of fetch(). Tests pass.
This is so that we can implement fetches of local objects.
I haven't yet done that, but it's coming up soon.
2020-08-05 15:32:03 +01:00
Marnanel Thurman 83f30d26db Logging is now via getLogger(name="kepi"), and this is done
before any other imports. This change is only partially finished;
it affects nothing except the logging but it should happen in all
the source files. There's just a lot of them.
2020-08-04 17:19:37 +01:00
Marnanel Thurman ccd1b0c26b fetch() rewritten to replace fetch_user() and fetch_status();
it now fetches anything, then checks the type.
Tests updated.

If create() is passed a dict where the "object" is a URL,
it fetches that URL and replaces "object" with its contents.
2020-08-04 17:19:17 +01:00
Marnanel Thurman d0cd984a43 bowler's tests have a DummyMessage class. It can now be instantiated with no arguments. 2020-08-03 20:22:11 +01:00
Marnanel Thurman 8c5637726b If get_webfinger() says the status is 0 (i.e. couldn't even connect),
fetch() doesn't amend that to 404.

test_fetch uses suppress_thread_exceptions, as added in commit 001698cd.
2020-08-03 20:16:29 +01:00
Marnanel Thurman 0ab2dae738 fetch() returns the existing record for a known remote user,
instead of fetching it again
2020-08-03 20:06:06 +01:00
Marnanel Thurman 001698cda6 Sombrero's webfinger support doesn't break if the remote host is unreachable
or times out. Tests updated.

Sombrero webfinger tests gain a context manager suppress_thread_exceptions(), to stop spurious exceptions being
reported if they occur in threads other than the main thread. See https://stackoverflow.com/questions/63206653/ .
2020-08-03 19:43:20 +01:00
Marnanel Thurman a6f3673fa7 new additions to requirements.txt 2020-08-03 19:39:30 +01:00
Marnanel Thurman 3a34ee7a6c Make sombrero support webfinger more completely.
Added tests, and some of them still fail.
2020-08-01 00:26:56 +01:00
Marnanel Thurman 634397402f fetch_user() is no longer a shared task-- if you want it to run it in
a shared task, create a wrapper. This means you have the option.

Very basic implementation of fetch_status().
2020-07-25 19:16:52 +01:00
Marnanel Thurman 77c3207c9c TestFetchUser: more error conditions tested, most of which currently
fail.

TestFetchStatus: stub.
2020-07-25 19:15:35 +01:00
Marnanel Thurman 06b9774418 Implemented the reblog fields of Status. Added "original" field.
Added tests for these.
2020-07-24 00:51:41 +01:00
Marnanel Thurman 3c16c92a22 First test for boost/Announce (fails) 2020-07-19 20:33:56 +01:00
Marnanel Thurman 9e7c78f196 added test_announce. All stubs. 2020-07-19 20:04:36 +01:00
Marnanel Thurman f29c6a3259 skip the mentions test until we implement mentions! 2020-07-17 21:31:44 +01:00
Marnanel Thurman ed7c5b5512 trilby_api's Status.lookup classmethod uses utils.find_local_view() rather than a regexp. 2020-07-17 18:38:29 +01:00
Marnanel Thurman 148e6c8aba bowler_pub has a new view to produce statuses, though
it's only a stub for now.
2020-07-17 18:37:31 +01:00