Skip to content

Latest commit

 

History

History
114 lines (84 loc) · 1.9 KB

TEST_API.md

File metadata and controls

114 lines (84 loc) · 1.9 KB

tests

PluginTest

PluginTest(self, methodName='runTest')

load_plugin

PluginTest.load_plugin(self, plugin_class)

Returns Plugin Instance (object). Works for both callable classes or methods.

Adds method run(string) - which execute plugin using mocked api.

queue_input

PluginTest.queue_input(self, msg)

Queue msg to be returned by 'jarvis.input()'

history_call

PluginTest.history_call(self)

Returns MockHistory instance. Fields:

  1. operation (string)
  2. args (tuple)
  3. return value

history_say

PluginTest.history_say(self)

Returns MockHistory instance. Fields:

  1. text (string)
  2. color (colorama.Fore.*)

history_notification

PluginTest.history_notification(self)

Returns MockHistory instance. Fields:

  1. msg (string)
  2. time_seconds (int)

history_schedule

PluginTest.history_schedule(self)

Returns MockHistory instance. Fields:

  1. time_seconds (int)
  2. function
  3. args (tuple)

MockHistory

MockHistory(self)

Record/Output history.

Recorded data sets must contain fixed and predefined number of "fields" (e.g. text and color).

Note: For Methods with first parameter "field" method "name_field" exist. So "view('text')" can be rewritten as "view_text".

record

MockHistory.record(self, *args)

Do not call manually!

contains

MockHistory.contains(self, field=None, value=None)

Check if value is recorded. If field is None, value should be a tuple of values for all fields.

view

MockHistory.view(self, field=None, index=None)

Returns value.

If field is None, returns tuple of all values for all fields. If index is None, returns all recorded values

last

MockHistory.last(self, field=None)

Shortcut for view with index -1

get_length

MockHistory.get_length(self)

Returns how many data sets were recorded