コード例 #1
0
	def test_user_order_transaction_relatons(self):
		buyer = User.create(username = '******')
		seller = User.create(username = '******')
		buy_order = Order.create(owner = buyer, side = Order.BUY)
		sell_order = Order.create(owner = seller, side = Order.SELL)
		transaction = Transaction(buy_order, sell_order, 1)
		
		buyer_fromdb = User.query.filter_by(username = '******').first()
		seller_fromdb = User.query.filter_by(username = '******').first()
		
		self.assertTrue(transaction.buyer.id == buyer_fromdb.id)
		self.assertTrue(transaction.seller.id == seller_fromdb.id)
コード例 #2
0
	def test_user_order_relations(self):
		user = User.create(username = '******')
		order = Order.create(owner = user)
		retreived_user = User.query.filter_by(username = '******').first()
		self.assertTrue(order.owner.id == retreived_user.id)
コード例 #3
0
	def seed_confirmed_user(username, password):
		return User.create(username=username, is_enabled=True, password=user_manager.hash_password(password), confirmed_at = datetime.now())
コード例 #4
0
	def test_database_insertion(self):
		self.assertTrue(len(User.query.all()) == 0)
		user = User.create(username = '******')
		self.assertTrue(len(User.query.all()) == 1)
コード例 #5
0
	def seed_nonconfirmed_user(username, password):
		return User.create(username=username, is_enabled=False, password=user_manager.hash_password(password))