示例#1
0
    def setUp(self):
        build_user()
        build_positions()

        mike = User(**{
             "username": "******",
             "realname": "Mike Bloom",
             "balance": 10000.0
        })
        mike.hash_password("password")
        mike.save()

        appl = Position(**{
            "ticker" : "AAPL",
            "amount": 5,
            "user_info_pk": mike.pk
        })

        tsla = Position(**{
            "ticker" : "TSLA",
            "amount": 10,
            "user_info_pk": mike.pk
        })

        appl.save()
        tsla.save()
示例#2
0
    def setUp(self):
        build_user()

        mike = User(**{
            "username": "******",
            "realname": "Mike Bloom",
            "balance": 10000.0
        })
        mike.hash_password("password")
        mike.save()
示例#3
0
    def setUp(self):
        build_user()
        build_positions()
        build_trades()

        mike = User(**{
            "username": "******",
            "realname": "Mike Bloom",
            "balance": 10000.0
        })
        mike.hash_password("password")
        mike.generate_api_key()
        mike.save()
示例#4
0
    def setUp(self):
        build_user()
        build_positions()
        build_trades()

        mike = User(
            **{
                "username": "******",
                "realname": "Mike Bloom",
                "balance": 10000000.0
            })
        mike.hash_password("password")
        mike.save()

        mike.buy("stok", 2)
        mike.sell("stok", 1)
示例#5
0
    def setUp(self):
        app.config['TESTING'] = True
        app.config['DEBUG'] = False
        self.app = app.test_client()
    
        build_user()
        build_positions()
        build_trades()

        mike = User(**{
        "user_name": "mikebloom",
        "password": "******",
        "real_name": "Mike Bloom",
        "balance": 0.0
        })
        mike.hash_password("password")
        mike.api_key = "11111111111111111111"
        mike.save()

        return app
示例#6
0
#!/usr/bin/env python3

import sqlite3
from model import User
from schema import build_user

build_user()

mike = User(
    **{
        "user_name": "mikebloom",
        "password": "******",
        "real_name": "Mike Bloom",
        "balance": 10000.0
    })

assert mike.password == "password"
assert mike.pk is None
mike.save()

user1 = User.frompk(1)
assert user1.user_name == "mikebloom"

user2 = User.frompk(2)
assert user2 is None

mike.password = "******"
mike.save()

mikeagain = User.frompk(1)
assert mikeagain.password == "12345"