Skip to content
Snippets Groups Projects
Commit 7270c488 authored by inso's avatar inso
Browse files

Merge branch 'dev' of github.com:duniter/sakia into dev

parents 244da336 8ee8ffe4
No related branches found
No related tags found
No related merge requests found
......@@ -72,7 +72,7 @@ class RelativeToPast(BaseReferential):
async def localized(self, units=False, international_system=False):
from . import Relative
value = await self.value()
block = await self.community.get_block()
block = await self.community.get_ud_block()
prefix = ""
if international_system:
localized_value, prefix = Relative.to_si(value, self.app.preferences['digits_after_comma'])
......@@ -95,7 +95,7 @@ class RelativeToPast(BaseReferential):
async def diff_localized(self, units=False, international_system=False):
from . import Relative
value = await self.differential()
block = await self.community.get_block(self._block_number)
block = await self.community.get_ud_block(0, self._block_number)
prefix = ""
if international_system and value != 0:
localized_value, prefix = Relative.to_si(value, self.app.preferences['digits_after_comma'])
......
......@@ -51,7 +51,7 @@ class TestRelativeToPast(unittest.TestCase, QuamashTest):
@patch('sakia.core.Application')
def test_localized_no_si(self, app, community):
community.dividend = CoroutineMock(return_value=1000)
community.get_block = CoroutineMock(return_value={'medianTime': 1452663088792})
community.get_ud_block = CoroutineMock(return_value={'medianTime': 1452663088792})
type(community).short_currency = PropertyMock(return_value="TC")
app.preferences = {
'digits_after_comma': 6
......@@ -70,7 +70,7 @@ class TestRelativeToPast(unittest.TestCase, QuamashTest):
@patch('sakia.core.Application')
def test_localized_with_si(self, app, community):
community.dividend = CoroutineMock(return_value=1000000)
community.get_block = CoroutineMock(return_value={'medianTime': 1452663088792})
community.get_ud_block = CoroutineMock(return_value={'medianTime': 1452663088792})
type(community).short_currency = PropertyMock(return_value="TC")
app.preferences = {
'digits_after_comma': 6
......@@ -89,7 +89,7 @@ class TestRelativeToPast(unittest.TestCase, QuamashTest):
@patch('sakia.core.Application')
def test_localized_no_units_no_si(self, app, community):
community.dividend = CoroutineMock(return_value=10000)
community.get_block = CoroutineMock(return_value={'medianTime': 1452663088792})
community.get_ud_block = CoroutineMock(return_value={'medianTime': 1452663088792})
type(community).short_currency = PropertyMock(return_value="TC")
app.preferences = {
'digits_after_comma': 6
......@@ -104,7 +104,7 @@ class TestRelativeToPast(unittest.TestCase, QuamashTest):
@patch('sakia.core.Application')
def test_localized_no_units_with_si(self, app, community):
community.dividend = CoroutineMock(return_value=1000000)
community.get_block = CoroutineMock(return_value={'medianTime': 1452663088792})
community.get_ud_block = CoroutineMock(return_value={'medianTime': 1452663088792})
type(community).short_currency = PropertyMock(return_value="TC")
app.preferences = {
'digits_after_comma': 6
......@@ -123,7 +123,7 @@ class TestRelativeToPast(unittest.TestCase, QuamashTest):
@patch('sakia.core.Application')
def test_diff_localized_no_si(self, app, community):
community.dividend = CoroutineMock(return_value=10000)
community.get_block = CoroutineMock(return_value={'medianTime': 1452663088792})
community.get_ud_block = CoroutineMock(return_value={'medianTime': 1452663088792})
type(community).short_currency = PropertyMock(return_value="TC")
app.preferences = {
'digits_after_comma': 6
......@@ -142,7 +142,7 @@ class TestRelativeToPast(unittest.TestCase, QuamashTest):
@patch('sakia.core.Application')
def test_diff_localized_with_si(self, app, community):
community.dividend = CoroutineMock(return_value=1000000)
community.get_block = CoroutineMock(return_value={'medianTime': 1452663088792})
community.get_ud_block = CoroutineMock(return_value={'medianTime': 1452663088792})
type(community).short_currency = PropertyMock(return_value="TC")
app.preferences = {
'digits_after_comma': 6
......@@ -161,7 +161,7 @@ class TestRelativeToPast(unittest.TestCase, QuamashTest):
@patch('sakia.core.Application')
def test_diff_localized_no_units_no_si(self, app, community):
community.dividend = CoroutineMock(return_value=10000)
community.get_block = CoroutineMock(return_value={'medianTime': 1452663088792})
community.get_ud_block = CoroutineMock(return_value={'medianTime': 1452663088792})
type(community).short_currency = PropertyMock(return_value="TC")
app.preferences = {
'digits_after_comma': 6
......@@ -176,7 +176,7 @@ class TestRelativeToPast(unittest.TestCase, QuamashTest):
@patch('sakia.core.Application')
def test_diff_localized_no_units_with_si(self, app, community):
community.dividend = CoroutineMock(return_value=1000000)
community.get_block = CoroutineMock(return_value={'medianTime': 1452663088792})
community.get_ud_block = CoroutineMock(return_value={'medianTime': 1452663088792})
type(community).short_currency = PropertyMock(return_value="TC")
app.preferences = {
'digits_after_comma': 6
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment