-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Port logic from establishing a device's region from hm-pktfwd.
- Loading branch information
1 parent
9240c3b
commit 2029e19
Showing
5 changed files
with
67 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from hm_pyhelper.miner_param import get_region, REGION_OVERRIDE_KEY | ||
import unittest | ||
from unittest.mock import mock_open, patch | ||
import os | ||
|
||
|
||
class TestGetRegion(unittest.TestCase): | ||
def test_get_region_from_override(self): | ||
os.environ[REGION_OVERRIDE_KEY] = 'foo' | ||
self.assertEqual(get_region(), 'foo') | ||
|
||
@patch("builtins.open", new_callable=mock_open, read_data="ZZ111\n") | ||
def test_get_region_from_miner(self, _): | ||
os.environ[REGION_OVERRIDE_KEY] = '' | ||
self.assertEqual(get_region(), 'ZZ111') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
jsonrpcclient==3.3.6 | ||
requests==2.26.0 | ||
retry==0.9.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
|
||
setup( | ||
name='hm_pyhelper', | ||
version='0.8.1', | ||
version='0.8.2', | ||
author="Nebra Ltd", | ||
author_email="[email protected]", | ||
description="Helium Python Helper", | ||
|