You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Obvious unworkability not caught by tests #60 (comment)
We need to implement tests for the behavior for all widgets eventually. They can be tackled one at a time, pull requests needn't cover all of these.
These unit tests should mock out any calls to state_model or api. They also should only create an instance of the widget being tested, not the entirety of Nix-Gui.
load Undefined, ensure everything is hidden, undefined toggle is off
load defined value, ensure everything is shown
load defined value that can be an int, bool, or str. Ensure clicking each type changes the active widget in self.entry_stack, also ensure no Updates are created
Obvious unworkability not caught by tests #60 (comment)
We need to implement tests for the behavior for all widgets eventually. They can be tackled one at a time, pull requests needn't cover all of these.
These unit tests should mock out any calls to
state_model
orapi
. They also should only create an instance of the widget being tested, not the entirety of Nix-Gui.Tests
Utilities:
https://github.com/pytest-dev/pytest-mock
https://docs.python.org/3/library/unittest.mock.html
field_widgets.py
Redirect
widget create a single test function which does the following__init__
current_value()
is a sane default and works (e.g.BooleanField
should beFalse
)pytest.mark.parameterize
to callload_value()
current_value()
is the passed valueFor
Null
assert it'scurrent_value
isNone
,UndefinedField
->Undefined
,NotImplementedField
-> assert raises an exceptionnavbar.py
up_fn
called when up is clicked (with mocked fn and check call)set_lookup_key_fn(None)
called when back is clickedset_lookup_key_fn
path_textbox
and assertset_lookup_key_fn
called with search keysearch_textbox
and assertset_lookup_key_fn
called withsearch:text
navlist.py
ensure clicking an item in
SearchResultListDisplay
results in a call toself.set_option_path_callback
ensure clicking an item in
StaticAttrsOf
results in a call toself.set_option_path_callback
TODO: Need to complete Complete Implementation of ListOf #30 and DynamicAttrsOf Improvements #72 before writing tests for
DynamicListOf
andDynamicAttrsOf
option_display.py
Undefined
, ensure everything is hidden, undefined toggle is offint
,bool
, orstr
. Ensure clicking each type changes the active widget inself.entry_stack
, also ensure noUpdate
s are createdIntegration Tests (out of scope of the issue?)
search
navlist.py
DynamicAttrsOf
itemDynamicListOf
item (make it more rigid so error: file 'nixos/modules' was not found in the Nix search path #224 (comment) doesn't happen again)The text was updated successfully, but these errors were encountered: