Compare commits

..

27 Commits

Author SHA1 Message Date
nolash
bc688ffad2 Uncomment gas tests 2021-05-31 17:07:49 +02:00
nolash
1f425bead8 Test remaining paths in resend gas task 2021-05-31 17:03:46 +02:00
nolash
40e96b775d Add coverage to pytest ci run 2021-05-31 16:41:07 +02:00
nolash
1473187abc Add full task signature to check gas tasks 2021-05-31 16:39:01 +02:00
nolash
ae711b0727 WIP Add check gas test 2021-05-31 12:45:03 +02:00
nolash
b88c290683 Add test branch for tx data with registry in admin api 2021-05-31 11:29:04 +02:00
nolash
a5608fcd98 Add default token test 2021-05-28 14:36:59 +02:00
nolash
4f8995fe46 Add test for tx retrieve 2021-05-28 14:19:36 +02:00
nolash
6a60d97d70 Add account tx admin api test 2021-05-28 12:35:43 +02:00
nolash
0b5fb22b25 Add fix nonce test, upgrade chainqueue 2021-05-28 11:12:34 +02:00
nolash
e54e7cf864 Upgrade cic-eth-registry 2021-05-27 21:15:24 +02:00
nolash
dd50eaf1ea Remove skips and wrong fixture sessionworkers 2021-05-27 20:59:42 +02:00
nolash
ccd9be194a Add check nonce (blocking) test 2021-05-27 20:52:38 +02:00
nolash
9558e20cc0 Add admin api registry, proxy, resend tests 2021-05-27 19:55:34 +02:00
nolash
1c86d55043 Fix wrong celery worker fixture type 2021-05-27 19:26:36 +02:00
nolash
43a2e9f0cc Rehabilitate shift nonce, add test 2021-05-27 19:21:30 +02:00
nolash
3434248912 80%! add synctx test 2021-05-27 17:16:48 +02:00
nolash
d18f9303cb Add multisend test, hash-to-tx resolve test 2021-05-27 16:16:18 +02:00
nolash
7ce708196c Add blockstat, registryconnect tests 2021-05-27 15:27:38 +02:00
nolash
ec58ef3414 Trigger all tests in ci 2021-05-27 14:43:50 +02:00
nolash
2339f52a32 Add register account filter test 2021-05-27 14:35:46 +02:00
nolash
740c1f7b91 Add register filter test 2021-05-27 14:24:18 +02:00
nolash
989a0cb976 Upgrade deps 2021-05-27 11:11:16 +02:00
nolash
eedaeede5c Add transferauth tests 2021-05-27 11:08:33 +02:00
nolash
7178373038 Add gas filter test 2021-05-27 09:54:21 +02:00
nolash
13561378ab Add liveness check tests 2021-05-27 09:12:27 +02:00
nolash
6214f00b83 Fix flaky test 2021-05-26 11:21:03 +02:00
5 changed files with 50 additions and 86 deletions

View File

@@ -89,7 +89,7 @@ def process_transactions_all_data(session, env):
offset = r[1]
end = r[2]
if int(r[2]) < int(r[1]):
if r[2] < r[1]:
raise ValueError('cart before the horse, dude')
c = DataCache(session)

View File

@@ -10,7 +10,7 @@ version = (
0,
11,
0,
'beta.15',
'beta.14',
)
version_object = semver.VersionInfo(

View File

@@ -2,24 +2,27 @@
# standard imports
import json
import time
import datetime
import random
import logging
import os
import base64
import hashlib
import sys
import argparse
import random
# external imports
import vobject
import celery
from faker import Faker
from collections import OrderedDict
import confini
from cic_types.models.person import (
Person,
generate_vcard_from_contact_data,
get_contact_data_from_vcard,
)
Person,
generate_vcard_from_contact_data,
get_contact_data_from_vcard,
)
from chainlib.eth.address import to_checksum_address
import phonenumbers
@@ -29,21 +32,17 @@ logg = logging.getLogger()
fake = Faker(['sl', 'en_US', 'no', 'de', 'ro'])
script_dir = os.path.realpath(os.path.dirname(__file__))
# config_dir = os.environ.get('CONFINI_DIR', '/usr/local/etc/cic')
#config_dir = os.environ.get('CONFINI_DIR', '/usr/local/etc/cic')
config_dir = os.environ.get('CONFINI_DIR', os.path.join(script_dir, 'config'))
argparser = argparse.ArgumentParser()
argparser.add_argument('-c', type=str, default=config_dir, help='Config dir')
argparser.add_argument('--tag', type=str, action='append',
help='Tags to add to record')
argparser.add_argument('--gift-threshold', type=int,
help='If set, users will be funded with additional random balance (in token integer units)')
argparser.add_argument('--tag', type=str, action='append', help='Tags to add to record')
argparser.add_argument('--gift-threshold', type=int, help='If set, users will be funded with additional random balance (in token integer units)')
argparser.add_argument('-v', action='store_true', help='Be verbose')
argparser.add_argument('-vv', action='store_true', help='Be more verbose')
argparser.add_argument('--dir', default='out', type=str,
help='path to users export dir tree')
argparser.add_argument('user_count', type=int,
help='amount of users to generate')
argparser.add_argument('--dir', default='out', type=str, help='path to users export dir tree')
argparser.add_argument('user_count', type=int, help='amount of users to generate')
args = argparser.parse_args()
if args.v:
@@ -61,23 +60,22 @@ dt_then = dt_now - datetime.timedelta(weeks=150)
ts_now = int(dt_now.timestamp())
ts_then = int(dt_then.timestamp())
celery_app = celery.Celery(broker=config.get(
'CELERY_BROKER_URL'), backend=config.get('CELERY_RESULT_URL'))
celery_app = celery.Celery(broker=config.get('CELERY_BROKER_URL'), backend=config.get('CELERY_RESULT_URL'))
gift_max = args.gift_threshold or 0
gift_factor = (10**6)
categories = [
"food/water",
"fuel/energy",
"education",
"health",
"shop",
"environment",
"transport",
"farming/labor",
"savingsgroup",
]
"food/water",
"fuel/energy",
"education",
"health",
"shop",
"environment",
"transport",
"farming/labor",
"savingsgroup",
]
phone_idx = []
@@ -90,7 +88,6 @@ if tags == None or len(tags) == 0:
random.seed()
def genPhoneIndex(phone):
h = hashlib.new('sha256')
h.update(phone.encode('utf-8'))
@@ -144,16 +141,16 @@ def genDob():
if random.random() > 0.5:
dob['month'] = dob_src.month
dob['day'] = dob_src.day
return dob
def gen():
old_blockchain_address = '0x' + os.urandom(20).hex()
old_blockchain_checksum_address = to_checksum_address(
old_blockchain_address)
old_blockchain_checksum_address = to_checksum_address(old_blockchain_address)
gender = random.choice(['female', 'male', 'other'])
phone = genPhone()
city = fake.city_name()
v = genPersonal(phone)
contact_data = get_contact_data_from_vcard(v)
@@ -164,63 +161,31 @@ def gen():
p.date_of_birth = genDob()
p.gender = gender
p.identities = {
'evm': {
'oldchain:1': [
old_blockchain_checksum_address,
],
},
}
p.products = [fake.random_element(elements=OrderedDict(
[('fruit', 0.25),
('maji', 0.05),
('milk', 0.1),
('teacher', 0.1),
('doctor', 0.05),
('boutique', 0.15),
('recycling', 0.05),
('farmer', 0.05),
('oil', 0.05),
('pastor', 0.1),
('chama', 0.03),
('pastor', 0.01),
('bzrTsuZieaq', 0.01)
]))]
p.location['area_name'] = fake.random_element(elements=OrderedDict(
[('mnarani', 0.05),
('chilumani', 0.1),
('madewani', 0.1),
('kisauni', 0.05),
('bangla', 0.1),
('kabiro', 0.1),
('manyani', 0.05),
('ruben', 0.15),
('makupa', 0.05),
('kingston', 0.05),
('rangala', 0.05),
('homabay', 0.1),
('nakuru', 0.03),
('kajiado', 0.01),
('zurtWicKtily', 0.01)
]))
'evm': {
'oldchain:1': [
old_blockchain_checksum_address,
],
},
}
p.location['area_name'] = city
if random.randint(0, 1):
# fake.local_latitude()
p.location['latitude'] = (random.random() + 180) - 90
# fake.local_latitude()
p.location['longitude'] = (random.random() + 360) - 180
p.location['latitude'] = (random.random() + 180) - 90 #fake.local_latitude()
p.location['longitude'] = (random.random() + 360) - 180 #fake.local_latitude()
return (old_blockchain_checksum_address, phone, p)
def prepareLocalFilePath(datadir, address):
parts = [
address[:2],
address[2:4],
]
address[:2],
address[2:4],
]
dirs = '{}/{}/{}'.format(
datadir,
parts[0],
parts[1],
)
datadir,
parts[0],
parts[1],
)
os.makedirs(dirs, exist_ok=True)
return dirs
@@ -273,10 +238,9 @@ if __name__ == '__main__':
ft.write('{}:{}\n'.format(eth, ','.join(tags)))
amount = genAmount()
fa.write('{},{}\n'.format(eth, amount))
logg.debug('pidx {}, uid {}, eth {}, amount {}, phone {}'.format(
pidx, uid, eth, amount, phone))
fa.write('{},{}\n'.format(eth,amount))
logg.debug('pidx {}, uid {}, eth {}, amount {}, phone {}'.format(pidx, uid, eth, amount, phone))
i += 1
ft.close()

View File

@@ -1,5 +1,5 @@
cic-base[full_graph]==0.1.2b11
sarafu-faucet==0.0.3a3
cic-eth==0.11.0b15
cic-eth==0.11.0b14
cic-types==0.1.0a11
crypto-dev-signer==0.4.14b3