Skip to content

Commit

Permalink
Remove operation 2 (CREATE) for estimation
Browse files Browse the repository at this point in the history
  • Loading branch information
Uxio0 committed Sep 30, 2020
1 parent 9df82c5 commit 15b6813
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 28 deletions.
10 changes: 5 additions & 5 deletions requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
-r requirements.txt
coverage==5.2.1
factory-boy==2.12.0
faker==4.1.2
coverage==5.3
factory-boy==3.0.1
faker==4.1.3
flake8==3.8.3
pytest-django==3.9.0
pytest-django==3.10.0
pytest-sugar==0.9.4
pytest==6.0.1
pytest==6.1.0
16 changes: 8 additions & 8 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
django==3.0.9
django==3.0.10
cachetools==4.1.1
celery==4.4.7
celery==5.0.0
django-authtools==1.7.0
django-celery-beat==2.0.0
django-debug-toolbar
django-debug-toolbar-force
django-environ==0.4.5
django-filter==2.3.0
django-filter==2.4.0
django-model-utils==4.0.0
django-redis==4.12.1
djangorestframework-camel-case==1.2.0
djangorestframework==3.11.1
djangorestframework==3.11.2
django-timezone-field==4.0
docutils==0.16
drf-yasg[validation]==1.17.1
ethereum==2.3.2
gnosis-py==2.6.2
gnosis-py==2.6.3
gunicorn[gevent]==20.0.4
hexbytes==0.2.1
lxml==4.5.2
numpy==1.19.1
numpy==1.19.2
packaging==20.4
psycopg2-binary==2.8.5
psycopg2-binary==2.8.6
redis==3.5.3
requests==2.24.0
web3==5.12.0
web3==5.12.1
3 changes: 2 additions & 1 deletion safe_relay_service/gas_station/tests/factories.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import factory.fuzzy
from factory.django import DjangoModelFactory

from ..models import GasPrice


class GasPriceFactory(factory.DjangoModelFactory):
class GasPriceFactory(DjangoModelFactory):
class Meta:
model = GasPrice

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Generated by Django 3.0.9 on 2020-09-22 10:00

from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models

import gnosis.eth.django.models


Expand Down
21 changes: 11 additions & 10 deletions safe_relay_service/relay/tests/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import factory.fuzzy
from eth_account import Account
from ethereum.utils import checksum_encode, mk_contract_address
from factory.django import DjangoModelFactory
from hexbytes import HexBytes
from web3 import Web3

Expand All @@ -20,15 +21,15 @@
logger = getLogger(__name__)


class SafeContractFactory(factory.DjangoModelFactory):
class SafeContractFactory(DjangoModelFactory):
class Meta:
model = SafeContract

address = factory.LazyFunction(lambda: Account.create().address)
master_copy = factory.LazyFunction(lambda: Account.create().address)


class SafeCreationFactory(factory.DjangoModelFactory):
class SafeCreationFactory(DjangoModelFactory):
class Meta:
model = SafeCreation

Expand All @@ -53,7 +54,7 @@ class Meta:
signed_tx = factory.Sequence(lambda n: HexBytes('%x' % (n + 5000)))


class SafeCreation2Factory(factory.DjangoModelFactory):
class SafeCreation2Factory(DjangoModelFactory):
class Meta:
model = SafeCreation2

Expand All @@ -76,14 +77,14 @@ class Meta:
block_number = None


class SafeFundingFactory(factory.DjangoModelFactory):
class SafeFundingFactory(DjangoModelFactory):
class Meta:
model = SafeFunding

safe = factory.SubFactory(SafeContractFactory)


class EthereumBlockFactory(factory.DjangoModelFactory):
class EthereumBlockFactory(DjangoModelFactory):
class Meta:
model = EthereumBlock

Expand All @@ -94,7 +95,7 @@ class Meta:
block_hash = factory.Sequence(lambda n: Web3.keccak(text='block%d' % n))


class EthereumTxFactory(factory.DjangoModelFactory):
class EthereumTxFactory(DjangoModelFactory):
class Meta:
model = EthereumTx

Expand All @@ -112,7 +113,7 @@ class Meta:
value = factory.fuzzy.FuzzyInteger(0, 1000)


class SafeMultisigTxFactory(factory.DjangoModelFactory):
class SafeMultisigTxFactory(DjangoModelFactory):
class Meta:
model = SafeMultisigTx

Expand All @@ -131,14 +132,14 @@ class Meta:
safe_tx_hash = factory.Sequence(lambda n: Web3.keccak(text='safe_tx_hash%d' % n))


class SafeTxStatusFactory(factory.DjangoModelFactory):
class SafeTxStatusFactory(DjangoModelFactory):
class Meta:
model = SafeTxStatus

safe = factory.SubFactory(SafeContractFactory)


class EthereumEventFactory(factory.DjangoModelFactory):
class EthereumEventFactory(DjangoModelFactory):
class Meta:
model = EthereumEvent

Expand All @@ -158,7 +159,7 @@ class Params:
)


class BannedSignerFactory(factory.DjangoModelFactory):
class BannedSignerFactory(DjangoModelFactory):
class Meta:
model = BannedSigner

Expand Down
12 changes: 12 additions & 0 deletions safe_relay_service/relay/tests/test_views_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,18 @@ def test_safe_multisig_tx_estimate_v2(self):
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(response.data['refund_receiver'], expected_refund_receiver)

data = {
'to': to,
'value': initial_funding // 2,
'data': None,
'operation': 2
}
response = self.client.post(reverse('v2:safe-multisig-tx-estimate', args=(my_safe_address,)),
data=data,
format='json')
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
self.assertIn('Please use Gnosis Safe CreateLib', str(response.data['non_field_errors']))

def test_safe_signal_v2(self):
safe_address = Account.create().address

Expand Down
7 changes: 4 additions & 3 deletions safe_relay_service/tokens/tests/factories.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import factory
from factory.django import DjangoModelFactory

from gnosis.eth.utils import get_eth_address_with_key

from .. import models


class PriceOracleFactory(factory.DjangoModelFactory):
class PriceOracleFactory(DjangoModelFactory):
class Meta:
model = models.PriceOracle

name = factory.Faker('company')


class TokenFactory(factory.DjangoModelFactory):
class TokenFactory(DjangoModelFactory):
class Meta:
model = models.Token

Expand All @@ -27,7 +28,7 @@ class Meta:
fixed_eth_conversion = 1


class PriceOracleTickerFactory(factory.DjangoModelFactory):
class PriceOracleTickerFactory(DjangoModelFactory):
class Meta:
model = models.PriceOracleTicker

Expand Down

0 comments on commit 15b6813

Please sign in to comment.