Predefined Steps¶
In order to use these steps with behave, you have to create a file like
in your steps directory.
cattle_grid.testing.features.steps.account ¶
create_account_step
async
¶
create_account_step(context, alice: str)
Creates an account with name alice
The connection is stored in context.connections[alice] it
is an Almabtrieb object.
Source code in cattle_grid/testing/features/steps/account.py
create_actor_step ¶
Source code in cattle_grid/testing/features/steps/account.py
cattle_grid.testing.features.steps.block ¶
send_block
async
¶
The id of the block is stored in context.block_id
Source code in cattle_grid/testing/features/steps/block.py
unblock
async
¶
Sends an Undo Block activity for
the id stored in context.block_id.
Usage:
Source code in cattle_grid/testing/features/steps/block.py
cattle_grid.testing.features.steps.collection ¶
check_collection
async
¶
Used to check if the followers or following collection
of the actor bob does not contain the actor alice.
Source code in cattle_grid/testing/features/steps/collection.py
check_collection_contains
async
¶
Used to check if the followers or following collection
of the actor bob contains the actor alice.
Source code in cattle_grid/testing/features/steps/collection.py
cattle_grid.testing.features.steps.drive ¶
cattle_grid.testing.features.steps.fetch ¶
alice_fetches_the_activity_pub_object
async
¶
This routine causes the URI stored in
context.actiivty_pub_uri to be fetched by the
actor corresponding to alice.
or
Source code in cattle_grid/testing/features/steps/fetch.py
alices_collection_has_number_of_elements
async
¶
Checks that the result from alice_fetches_the_activity_pub_object has a “collection” containing number of elements. Specifying an actor, e.g. “Alice”, is necessary as a fetch request is performed.
Source code in cattle_grid/testing/features/steps/fetch.py
check_fail ¶
Checks that the result in `context.fetch_response indicates failure.
Source code in cattle_grid/testing/features/steps/fetch.py
check_response_type ¶
Checks that the result in `context.fetch_response is of a predetermined type
Source code in cattle_grid/testing/features/steps/fetch.py
object_has_collection ¶
Checks that the result from alice_fetches_the_activity_pub_object has a property of type “collection”
Source code in cattle_grid/testing/features/steps/fetch.py
cattle_grid.testing.features.steps.follow ¶
accept_follow_request
async
¶
Checks that Alice received a follow Activity and then accepts this follow activity
Source code in cattle_grid/testing/features/steps/follow.py
actor_follows_other ¶
Combination of two steps, i.e.
is the same as
Source code in cattle_grid/testing/features/steps/follow.py
automatically_accept_followers
async
¶
FIXME: Should toggle
Source code in cattle_grid/testing/features/steps/follow.py
send_follow
async
¶
Sends a follow Activity. Usage
Stores the follow activity in context.follow_activity
Source code in cattle_grid/testing/features/steps/follow.py
send_reject_follow
async
¶
Sends an Undo Follow activity for the follow activity
with id stored in context.follow_activity.
Usage:
Source code in cattle_grid/testing/features/steps/follow.py
send_undo_follow
async
¶
Sends an Undo Follow activity for the follow activity
with id stored in context.follow_activity.
Usage:
Source code in cattle_grid/testing/features/steps/follow.py
cattle_grid.testing.features.steps.http ¶
check_response_status_code ¶
Checks the status code of the response to be status_code.
Source code in cattle_grid/testing/features/steps/http.py
make_request
async
¶
Performs the request
Source code in cattle_grid/testing/features/steps/http.py
request_set_content_type ¶
Sets the content type of the request
request_url_is_actor ¶
Sets the propert context.request to alice’s actor uri
Source code in cattle_grid/testing/features/steps/http.py
response_is_webpage ¶
Check that the response in context.response has a content-type header
starting with text/html
Source code in cattle_grid/testing/features/steps/http.py
cattle_grid.testing.features.steps.interactions ¶
alice_announced ¶
alias for
Given "{alice}" fetches the ActivityPub object
When "{alice}" announces the ActivityPub object
Then For "{alice}", the "shares" collection contains "one" element
Source code in cattle_grid/testing/features/steps/interactions.py
alice_deletes_reply
async
¶
Deletes the replied in `context.interaction_id.
Source code in cattle_grid/testing/features/steps/interactions.py
alice_liked ¶
alias for
Given "{alice}" fetches the ActivityPub object
When "{alice}" likes the ActivityPub object
Then For "{alice}", the "likes" collection contains "one" element
Source code in cattle_grid/testing/features/steps/interactions.py
alice_likes
async
¶
Alice likes the object given by alice_fetches_the_activity_pub_object Example usage
Source code in cattle_grid/testing/features/steps/interactions.py
alice_replied ¶
alias for
Given "{alice}" fetches the ActivityPub object
When "{alice}" replies to the ActivityPub object with "Nice post!"
Then For "{alice}", the "replies" collection contains "one" element
Source code in cattle_grid/testing/features/steps/interactions.py
alice_replies
async
¶
Replies with text to the ActivityPub object
Source code in cattle_grid/testing/features/steps/interactions.py
alice_shares
async
¶
Sends an announce activity
Source code in cattle_grid/testing/features/steps/interactions.py
alice_undoes
async
¶
Alice undoes the last interaction with the object given by alice_fetches_the_activity_pub_object Example usage
Source code in cattle_grid/testing/features/steps/interactions.py
cattle_grid.testing.features.steps.message_content ¶
Routines to check the content of a message as retrieved by cattle_grid.testing.features.steps.messaging.receive_message
message_contains_url_of_mediatype ¶
The resolved url is added to context.media_type_link.
Source code in cattle_grid/testing/features/steps/message_content.py
url_resolves_to_webpage_containing_text
async
¶
Source code in cattle_grid/testing/features/steps/message_content.py
cattle_grid.testing.features.steps.messaging ¶
check_activity_type ¶
Checks that the received activity from cattle_grid.testing.features.steps.messaging.receive_activity
is of type activity_type.
Source code in cattle_grid/testing/features/steps/messaging.py
not_receive_activity
async
¶
Ensures that no incoming activity was received
Source code in cattle_grid/testing/features/steps/messaging.py
receive_activity
async
¶
Ensures that an incoming activity was received
and stores it in context.activity.
Source code in cattle_grid/testing/features/steps/messaging.py
receive_message
async
¶
Used to check if the last message received by actor is saying the correct thing.
The received object is stored in context.received_object.
Source code in cattle_grid/testing/features/steps/messaging.py
send_message
async
¶
Used to send a message. The message has the format (with a lot of stuff omitted)
This step can be used as
Source code in cattle_grid/testing/features/steps/messaging.py
send_message_followers
async
¶
Used to send a message to the followers. The message has the format (with a lot of stuff omitted)
{
"type": "Create",
"object": {
"type": "Note",
"content": text,
"to": [followers_collection_of_actor]
}
}
This step can be used as
Source code in cattle_grid/testing/features/steps/messaging.py
cattle_grid.testing.features.steps.user ¶
actor_deletes_themselves
async
¶
Source code in cattle_grid/testing/features/steps/user.py
fetch_profile
async
¶
The profile is stored in context.profile
Source code in cattle_grid/testing/features/steps/user.py
in_group
async
¶
Source code in cattle_grid/testing/features/steps/user.py
new_user ¶
Creates a new user
Usage example: