Wykres commitów

1242 Commity (37d53b2e4e12cffaa8d1d1a574c2ff1e71f8511b)

Autor SHA1 Wiadomość Data
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
Marnanel Thurman 550b56d537 Person.lookup now uses find_local_view() instead of a RE 2020-07-16 19:38:43 +01:00
Marnanel Thurman 450cca5d1d find_local_view(), plus tests. 2020-07-16 19:27:41 +01:00
Marnanel Thurman 02c0941744 various fixes to TestCreate; test_with_mentions still fails but
all others either pass, skip, or expectedFail.
2020-07-15 19:28:11 +01:00
Marnanel Thurman 3a881296f0 When create() looks up message['object']['type'], it now catches
and ignores TypeError, since "object" can validly be a string.
If it is a string, we can't do anything with its type anyway.

Validation tests now pass.
2020-07-15 18:49:37 +01:00
Marnanel Thurman 10a05c1835 test_public passes 2020-07-15 03:55:59 +01:00
Marnanel Thurman 6cd61046dc skip test_private, for now-- spec is ambiguous and we're going
to have to read through masto's code
2020-07-15 03:38:30 +01:00
Marnanel Thurman 5fa254d764 Status gains 'text' property, at present a synonym of 'content' 2020-07-14 21:10:21 +01:00
Marnanel Thurman b4cce9fc0f indentation 2020-07-14 21:07:57 +01:00
Marnanel Thurman ad93d08093 test_limited may be a mistake in the Mastodon docs 2020-07-14 21:07:18 +01:00
Marnanel Thurman 396af7823e bowler_pub.create now takes account of audience to calculate
visbility.

TestCreate.test_direct passes.
2020-07-14 20:56:02 +01:00
Marnanel Thurman 9738af96a0 _send_create_for_object returns the created object (if it's a Status)
in the way it used to
2020-07-11 23:36:21 +01:00
Marnanel Thurman 489fd453e0 test_create's as_reply_to test passes. Lots still to do here. 2020-07-11 23:29:12 +01:00
Marnanel Thurman d77a43befd trilby's Status gains methods and properties:
- conversation (stub)
	- is_reply (working)
	- in_reply_to_account_id (working)
	- thread (working)
	- __str__ (working)
	- lookup (class method, working)
2020-07-11 23:27:21 +01:00
Marnanel Thurman 287aef2b3b bowler_pub's create() chooses its helper function based on the
type of the activity's object as well as the activity's own type.

Helper function for creating Notes added.
2020-07-11 23:23:53 +01:00
Marnanel Thurman e8be446910 first param of a class method is "cls", not "self" 2020-07-11 23:23:06 +01:00
Marnanel Thurman 82c52d157c DummyMessage has a __str__, so that debug logs look a little less weird 2020-07-09 00:14:18 +01:00
Marnanel Thurman 14c32dc823 fixing up bowler's test_create for trilby-heavy. This has brought
the tests to the point where we can see they're not passing. :)
2020-07-09 00:10:53 +01:00