Skip to content

aea.test_tools.test_protocol

This module contains test case classes based on pytest for AEA protocol testing.

BaseProtocolMessagesTestCase Objects

class BaseProtocolMessagesTestCase(ABC)

Base class to test messages for the protocol.

MESSAGE_CLASS

@property
@abstractmethod
def MESSAGE_CLASS() -> Type[Message]

Override this property in a subclass.

perform_message_test

def perform_message_test(msg: Message) -> None

Test message encode/decode.

test_messages_ok

def test_messages_ok() -> None

Run messages are ok for encode and decode.

test_messages_inconsistent

def test_messages_inconsistent() -> None

Run messages are inconsistent.

test_messages_fail_to_encode_decode

def test_messages_fail_to_encode_decode() -> None

Run messages are failing to encode and decode.

build_messages

@abstractmethod
def build_messages() -> List[Message]

Build the messages to be used for testing.

build_inconsistent

@abstractmethod
def build_inconsistent() -> List[Message]

Build inconsistent messages to be used for testing.

BaseProtocolDialoguesTestCase Objects

class BaseProtocolDialoguesTestCase(ABC)

Base class to test message construction for the protocol.

MESSAGE_CLASS

@property
@abstractmethod
def MESSAGE_CLASS() -> Type[Message]

Override this property in a subclass.

DIALOGUE_CLASS

@property
@abstractmethod
def DIALOGUE_CLASS() -> Type[Dialogue]

Override this property in a subclass.

DIALOGUES_CLASS

@property
@abstractmethod
def DIALOGUES_CLASS() -> Type[Dialogues]

Override this property in a subclass.

ROLE_FOR_THE_FIRST_MESSAGE

@property
@abstractmethod
def ROLE_FOR_THE_FIRST_MESSAGE() -> Dialogue.Role

Override this property in a subclass.

role_from_first_message

def role_from_first_message(message: Message,
                            receiver_address: Address) -> Dialogue.Role

Infer the role of the agent from an incoming/outgoing first message

Arguments:

  • message: an incoming/outgoing first message
  • receiver_address: the address of the receiving agent

Returns:

The role of the agent

make_dialogues_class

def make_dialogues_class() -> Type[Dialogues]

Make dialogues class with specific role.

make_message_content

@abstractmethod
def make_message_content() -> dict

Make a dict with message contruction content for dialogues.create.

test_dialogues

def test_dialogues() -> None

Test dialogues.