Skip to content

Commit

Permalink
fixed update procedure for transaction on download_beta_screen, flash…
Browse files Browse the repository at this point in the history
…_screen and wipe_screen
  • Loading branch information
qlrd committed Oct 24, 2024
1 parent 9156eb6 commit 758ea23
Show file tree
Hide file tree
Showing 7 changed files with 296 additions and 163 deletions.
4 changes: 2 additions & 2 deletions .pylint/src
Original file line number Diff line number Diff line change
Expand Up @@ -300,13 +300,13 @@ max-bool-expr=5
max-branches=25

# Maximum number of locals for function / method body.
max-locals=24
max-locals=20

# Maximum number of parents for a class (see R0901).
max-parents=10

# Maximum number of public methods for a class (see R0904).
max-public-methods=25
max-public-methods=30

# Maximum number of return / yield for function / method body.
max-returns=7
Expand Down
4 changes: 2 additions & 2 deletions e2e/test_022_flash_screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ def test_update_locale(self, mock_get_locale):

# get your Window instance safely
EventLoop.ensure_window()
screen.update(name=screen.name, key="locale", value="en_US.UTF8")
screen.update(name=screen.name, key="locale", value="en_US.UTF-8")

self.assertEqual(screen.locale, "en_US.UTF8")
self.assertEqual(screen.locale, "en_US.UTF-8")

# patch assertions
mock_get_locale.assert_called()
Expand Down
16 changes: 11 additions & 5 deletions e2e/test_023_wipe_screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ def teardown_class(cls):
EventLoop.exit()

@patch.object(EventLoopBase, "ensure_window", lambda x: None)
@patch("src.app.screens.base_screen.BaseScreen.get_locale")
@patch(
"src.app.screens.base_screen.BaseScreen.get_locale", return_value="en_US.UTF-8"
)
@patch("src.app.screens.wipe_screen.partial")
@patch("src.app.screens.wipe_screen.Clock.schedule_once")
def test_init(self, mock_schedule_once, mock_partial, mock_get_locale):
Expand Down Expand Up @@ -69,16 +71,18 @@ def test_fail_update_wrong_name(self, mock_redirect_exception, mock_get_locale):
mock_redirect_exception.assert_called_once()

@patch.object(EventLoopBase, "ensure_window", lambda x: None)
@patch("src.app.screens.base_screen.BaseScreen.get_locale")
@patch(
"src.app.screens.base_screen.BaseScreen.get_locale", return_value="en_US.UTF-8"
)
def test_update_locale(self, mock_get_locale):
screen = WipeScreen()
self.render(screen)

# get your Window instance safely
EventLoop.ensure_window()
screen.update(name=screen.name, key="locale", value="en_US.UTF8")
screen.update(name=screen.name, key="locale", value="en_US.UTF-8")

self.assertEqual(screen.locale, "en_US.UTF8")
self.assertEqual(screen.locale, "en_US.UTF-8")

# patch assertions
mock_get_locale.assert_called_once()
Expand All @@ -101,7 +105,9 @@ def test_update_device(self, mock_get_locale):
mock_get_locale.asset_called_once()

@patch.object(EventLoopBase, "ensure_window", lambda x: None)
@patch("src.app.screens.base_screen.BaseScreen.get_locale")
@patch(
"src.app.screens.base_screen.BaseScreen.get_locale", return_value="en_US.UTF-8"
)
def test_update_wiper(self, mock_get_locale):
screen = WipeScreen()
self.render(screen)
Expand Down
Loading

0 comments on commit 758ea23

Please sign in to comment.