Test classes

SkPy comes with some test cases that cover expectations from the server, and the correctness of the library's parsing.

Client testing

Here, responses from the server are mocked out and replaced with static strings, so the real Skype server is never contacted. Test cases aim to ensure the library parses each response correctly.

class test.client.Data[source]

Dummy representations of data normally retrieved from Skype.

test.client.registerMocks(regTokenRedirect=False, guest=False)[source]

Override external calls to Skype APIs with static responses using responses.

Parameters
  • regTokenRedirect (bool) -- whether to emulate the 'user is on another cloud' host redirect
  • guest (bool) -- whether to emulate a guest account
test.client.mockSkype()[source]

Create a fake, pre-connected Skype instance.

class test.client.SkypeClientTest[source]

Main test class for all SkPy code.

Each test method enables the intercepting of API calls as defined in registerMocks().

Note that tests should be designed to evaluate local code -- they are not testing correctness of the Skype APIs, rather that the local classes handle the requests and responses appropriately.

testAuth()[source]

Complete the auth flow with a dummy username and password.

testAuthRedirect()[source]

Complete the auth flow with a dummy username and password, including a messenger hostname redirect.

testGuestAuth()[source]

Complete the auth flow as a guest joining a conversation.

testContactList()[source]

Collect a list of contacts for the current user.

testChatList()[source]

Collect a list of conversations for the current user.

testChatGetMsgs()[source]

Collect a list of messages for a conversation.

testChatSendMsgs()[source]

Send various types of messages, and check the resulting SkypeMsg instances.

testUtils()[source]

Various tests for parsing provided by SkypeUtils.

Server testing

These tests connect to the production Skype server to perform actions, checking that requests to and responses from the server are consistent with the library.

class test.server.SkypeServerTestBase[source]

Base class for tests designed to interpret server responses.

Warning

This requires access to a live Skype account, the credentials for which will be read from .tokens (or from a file named in environment variable SKPY_TESTSERVER_TOKENS if set). This can be accomplished in a shell:

>>> from skpy import Skype
>>> Skype(username, password, tokenFile=".tokens")

You must also set SKPY_TESTSERVER_RECIP to a contact on the account that should receive test messages.

class test.server.SkypeServerReadTest[source]

Basic, read-only tests on information provided by the server for the connected account.

testSelf()[source]

Retrieve the current user.

testSettings()[source]

Read all setting fields for the current user.

testContacts()[source]

Retrieve the named recipient as a user and a contact.

testChats()[source]

Retrieve a conversation with the named recipient.

testTranslate()[source]

Request a text translation.

testServices()[source]

Retrieve the services list for the current user.

class test.server.SkypeServerWriteTest[source]

Specific test cases that require performing "write" actions on the connected account.

testGroupChats()[source]

Create a group chat with the named recipient, send a test message, and invite a guest.

class test.server.SkypeServerEventTest[source]

Specific test cases that poll the event stream, and require external data (i.e. sending messages from another client to this user account).

testPasswordLogin()[source]

Attempt a fresh login with a username and password.

testMessageEvent()[source]

Receive a message from the named recipient.