Move stuff in silly places
This commit is contained in:
@@ -6,9 +6,9 @@ from json import loads
|
||||
from copy import deepcopy
|
||||
|
||||
from tests.common import fake_public_ads, cg_prices, expected_to_update
|
||||
from sources.agora import Agora
|
||||
from markets import Markets
|
||||
from money import Money
|
||||
import sources.agora
|
||||
import lib.markets
|
||||
import lib.money
|
||||
import util
|
||||
import settings
|
||||
|
||||
@@ -24,9 +24,9 @@ class TestAgora(TestCase):
|
||||
super().__init__(*args, *kwargs)
|
||||
|
||||
def setUp(self):
|
||||
self.markets = Markets()
|
||||
self.agora = Agora()
|
||||
self.money = Money()
|
||||
self.markets = lib.markets.Markets()
|
||||
self.agora = sources.agora.Agora()
|
||||
self.money = lib.money.Money()
|
||||
setattr(self.agora, "markets", self.markets)
|
||||
setattr(self.money, "markets", self.markets)
|
||||
setattr(self.agora, "money", self.money)
|
||||
|
||||
@@ -6,9 +6,9 @@ from json import loads
|
||||
from copy import deepcopy
|
||||
|
||||
from tests.common import fake_public_ads_lbtc, cg_prices, expected_to_update_lbtc
|
||||
from sources.localbitcoins import LBTC
|
||||
from markets import Markets
|
||||
from money import Money
|
||||
import sources.localbitcoins
|
||||
import lib.markets
|
||||
import lib.money
|
||||
import util
|
||||
import settings
|
||||
import sources
|
||||
@@ -25,9 +25,9 @@ class TestLBTC(TestCase):
|
||||
super().__init__(*args, *kwargs)
|
||||
|
||||
def setUp(self):
|
||||
self.markets = Markets()
|
||||
self.lbtc = LBTC()
|
||||
self.money = Money()
|
||||
self.markets = lib.markets.Markets()
|
||||
self.lbtc = sources.localbitcoins.LBTC()
|
||||
self.money = lib.money.Money()
|
||||
self.sources = sources.Sources()
|
||||
setattr(self.markets, "sources", self.sources)
|
||||
setattr(self.lbtc, "markets", self.markets)
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
from unittest import TestCase
|
||||
from unittest.mock import MagicMock
|
||||
from tests.common import fake_public_ads, expected_to_update
|
||||
from markets import Markets
|
||||
import lib.markets
|
||||
from sources.agora import Agora
|
||||
import settings
|
||||
|
||||
|
||||
class TestMarkets(TestCase):
|
||||
def setUp(self):
|
||||
self.markets = Markets()
|
||||
self.markets = lib.markets.Markets()
|
||||
self.agora = Agora()
|
||||
self.markets.sinks = MagicMock()
|
||||
self.markets.sinks.currencies = [
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
from unittest import TestCase
|
||||
from money import Money
|
||||
import lib.money
|
||||
|
||||
|
||||
class TestMoney(TestCase):
|
||||
def setUp(self):
|
||||
self.money = Money()
|
||||
self.money = lib.money.Money()
|
||||
|
||||
def test_lookup_rates(self):
|
||||
# Move from Agora tests
|
||||
|
||||
@@ -2,13 +2,14 @@ from unittest import TestCase
|
||||
from unittest.mock import MagicMock
|
||||
from copy import deepcopy
|
||||
|
||||
import transactions
|
||||
import money
|
||||
import lib.transactions
|
||||
import lib.money
|
||||
import lib.antifraud
|
||||
|
||||
|
||||
class TestTransactions(TestCase):
|
||||
def setUp(self):
|
||||
self.transactions = transactions.Transactions()
|
||||
self.transactions = lib.transactions.Transactions()
|
||||
self.test_data = {
|
||||
"timestamp": "2022-03-14T19:34:13.501Z",
|
||||
"description": "Received Rebiere Matthieu",
|
||||
@@ -30,10 +31,10 @@ class TestTransactions(TestCase):
|
||||
}
|
||||
|
||||
# Mock redis calls
|
||||
transactions.db.r.hgetall = self.mock_hgetall
|
||||
transactions.db.r.hmset = self.mock_hmset
|
||||
transactions.db.r.keys = self.mock_keys
|
||||
transactions.db.r.get = self.mock_get
|
||||
lib.transactions.db.r.hgetall = self.mock_hgetall
|
||||
lib.transactions.db.r.hmset = self.mock_hmset
|
||||
lib.transactions.db.r.keys = self.mock_keys
|
||||
lib.transactions.db.r.get = self.mock_get
|
||||
|
||||
# Mock some callbacks
|
||||
self.transactions.irc = MagicMock()
|
||||
@@ -42,6 +43,7 @@ class TestTransactions(TestCase):
|
||||
self.transactions.ux = MagicMock()
|
||||
self.transactions.ux.notify = MagicMock()
|
||||
self.transactions.ux.notify.notify_complete_trade = MagicMock()
|
||||
self.transactions.antifraud = lib.antifraud.AntiFraud
|
||||
|
||||
# Mock the rates
|
||||
self.transactions.money = MagicMock()
|
||||
@@ -50,7 +52,7 @@ class TestTransactions(TestCase):
|
||||
self.transactions.money.get_rates_all.return_value = {"GBP": 0.8}
|
||||
|
||||
# Don't mock the functions we want to test
|
||||
self.money = money.Money()
|
||||
self.money = lib.money.Money()
|
||||
self.money.get_rates_all = MagicMock()
|
||||
self.money.get_rates_all.return_value = {"GBP": 0.8}
|
||||
self.transactions.money.get_acceptable_margins = self.money.get_acceptable_margins
|
||||
|
||||
Reference in New Issue
Block a user