Beispiel #1
0
 def setUp(self):
     self.admin = AdminFactory()
     self.client.credentials(HTTP_AUTHORIZATION="Token " +
                             self.admin.auth_token.key)
     self.asset_class = AssetClassFactory(name="Asset Class")
     self.data = {
         "name": "Asset Class Name",
         "alt_name": "Asset Class Alt Name",
         "is_active": True,
     }
Beispiel #2
0
 def setUp(self):
     self.admin = AdminFactory()
     self.client.credentials(HTTP_AUTHORIZATION="Token " +
                             self.admin.auth_token.key)
     self.user = UserFactory(first_name="Name")
     self.data = {
         "first_name": "Test",
         "last_name": "User",
         "email": "*****@*****.**",
         "is_active": True,
         "is_staff": False,
         "is_superuser": False,
     }
Beispiel #3
0
 def setUp(self):
     self.admin = AdminFactory()
     self.user = UserFactory()
     self.asset = AssetFactory(symbol="AAPL")
     self.strategy = StrategyFactory(asset=self.asset)
     self.client.credentials(HTTP_AUTHORIZATION="Token " + self.admin.auth_token.key)
     self.order_1 = OrderFactory(
         user=self.user, strategy=self.strategy, asset_id=self.asset
     )
     self.order_2 = OrderFactory(
         user=self.user, strategy=self.strategy, asset_id=self.asset
     )
     self.order_3 = OrderFactory()
     self.order_4 = OrderFactory()
Beispiel #4
0
 def setUp(self):
     self.admin = AdminFactory()
     self.client.credentials(HTTP_AUTHORIZATION="Token " +
                             self.admin.auth_token.key)
     self.asset = AssetFactory(symbol="AAPL")
     self.bar_1 = BarFactory(asset=self.asset, t=100000)
     self.bar_2 = BarFactory(asset=self.asset, t=150000)
     self.bar_3 = BarFactory(asset=self.asset, t=200000)
     self.data = {
         "asset": self.asset.symbol,
         "t": 2100000000,
         "o": 100.01,
         "h": 110.05,
         "l": 99.05,
         "c": 105.01,
         "v": 200000,
     }
def test_admins_should_have_permissions_to_manage_users(root_page):
    """Admins should have all required permissions to manage users."""
    admin = AdminFactory.get(root_page)
    permissions = {
        'auth.add_group',
        'auth.add_permission',
        'auth.add_user',
        'auth.change_group',
        'auth.change_permission',
        'auth.change_user',
        'auth.delete_group',
        'auth.delete_permission',
        'auth.delete_user',
        'wagtailusers.add_userprofile',
        'wagtailusers.change_userprofile',
        'wagtailusers.delete_userprofile',
    }
    assert not (permissions - admin.user.get_all_permissions())
Beispiel #6
0
 def setUp(self):
     self.admin = AdminFactory()
     self.client.credentials(HTTP_AUTHORIZATION="Token " +
                             self.admin.auth_token.key)
     self.exchange = ExchangeFactory()
     self.asset_class = AssetClassFactory()
     self.asset = AssetFactory(name="Asset",
                               exchange=self.exchange,
                               asset_class=self.asset_class)
     self.data = {
         "id": str(uuid.uuid4()),
         "name": "Asset Name",
         "asset_class": self.asset_class.name,
         "easy_to_borrow": True,
         "exchange": self.exchange.name,
         "marginable": True,
         "shortable": True,
         "status": Asset.ACTIVE,
         "symbol": "SYMBOL",
         "tradable": True,
     }
def test_admin_user_should_be_able_to_access_manage_users_page(root_page):
    """Admins can access '/admin/users/' page"""
    admin = AdminFactory.get(root_page)
    resp = admin.client.get(reverse('wagtailusers_users:index'))
    assert resp.status_code == status.HTTP_200_OK
Beispiel #8
0
 def setUp(self):
     self.admin = AdminFactory()
     self.user_1 = UserFactory()
     self.user_2 = UserFactory()
     self.strategy = StrategyFactory(user=self.user_1)
Beispiel #9
0
 def setUpTestData(cls):
     cls.admin = AdminFactory()
     cls.request = RequestFactory().get("/")
     cls.request.user = cls.admin
Beispiel #10
0
 def setUp(self):
     self.admin = AdminFactory()
     self.user_1 = UserFactory()
     self.user_2 = UserFactory()
     self.order_1 = OrderFactory(user=self.user_1)
 def setUpTestData(cls):
     cls.admin = AdminFactory()
     cls.request = RequestFactory().get("/")
     cls.request.user = cls.admin
     cls.datetime = "2020-11-29T00:00:00Z"