def setUp(self): super(FirmAnalyticsMixinTests, self).setUp() self.support_group = GroupFactory(name=GROUP_SUPPORT_STAFF) self.bonds_type = InvestmentType.Standard.BONDS.get() self.stocks_type = InvestmentType.Standard.STOCKS.get() self.view = self.DummyView() self.today = today = timezone.now().date() # Populate the AccountType -> RiskProfileGroup mapping for atid, _ in constants.ACCOUNT_TYPES: AccountTypeRiskProfileGroupFactory.create(account_type=atid) # first client self.betasmartz_client = ClientFactory.create() self.client_account = ClientAccountFactory.create( primary_owner=self.betasmartz_client, account_type=constants.ACCOUNT_TYPE_PERSONAL) self.firm = self.betasmartz_client.advisor.firm self.external_asset1 = ExternalAssetFactory.create( owner=self.betasmartz_client) self.external_asset2 = ExternalAssetFactory.create( owner=self.betasmartz_client) self.goal = GoalFactory.create(account=self.client_account) self.goal2 = GoalFactory.create(account=self.client_account) self.transaction = TransactionFactory.create( to_goal=self.goal, from_goal=self.goal2, amount=self.goal.cash_balance, status=Transaction.STATUS_EXECUTED, reason=Transaction.REASON_TRANSFER, executed=self.today) # second client self.betasmartz_client2 = ClientFactory.create( advisor=self.betasmartz_client.advisor) self.client_account2 = ClientAccountFactory.create( primary_owner=self.betasmartz_client2, account_type=constants.ACCOUNT_TYPE_PERSONAL) self.external_asset1 = ExternalAssetFactory.create( owner=self.betasmartz_client2) self.external_asset2 = ExternalAssetFactory.create( owner=self.betasmartz_client2) self.goal3 = GoalFactory.create(account=self.client_account2) self.goal4 = GoalFactory.create(account=self.client_account2) self.transaction2 = TransactionFactory.create( to_goal=self.goal3, from_goal=self.goal4, amount=self.goal3.cash_balance, status=Transaction.STATUS_EXECUTED, reason=Transaction.REASON_TRANSFER, executed=self.today)
def setUp(self): for atid, _ in constants.ACCOUNT_TYPES: AccountTypeRiskProfileGroupFactory.create(account_type=atid) self.today = today = date(2016, 5, 1) self.older_fiscal_year = FiscalYearFactory.create() self.older_fiscal_year2 = FiscalYearFactory.create() self.current_fiscal_year = FiscalYearFactory.create( year=today.year, begin_date=datetime(year=today.year, month=1, day=1), end_date=datetime(year=today.year, month=12, day=31)) self.firm = FirmFactory.create() self.firm.fiscal_years.add(self.older_fiscal_year) self.firm.fiscal_years.add(self.older_fiscal_year2) self.firm.fiscal_years.add(self.current_fiscal_year) # add an advisor for the firm self.advisor = AdvisorFactory.create(firm=self.firm) # add a client account for the firm self.betasmartz_client = ClientFactory.create(advisor=self.advisor) self.client_account = ClientAccountFactory.create( primary_owner=self.betasmartz_client) # add some goals self.goal1 = GoalFactory.create(account=self.client_account) self.goal2 = GoalFactory.create(account=self.client_account) # add some transaction fees associated with the goals # there are two fees here, one for the from_goal1, and one for the to_goal2 self.fee1 = TransactionFactory.create( reason=Transaction.REASON_FEE, status=Transaction.STATUS_EXECUTED, from_goal=self.goal1, to_goal=self.goal2, amount=500, executed=today - relativedelta(months=1)) # add new advisor to firm # add new clientacounts for advisor and fees self.advisor2 = AdvisorFactory.create(firm=self.firm) self.betasmartz_client2 = ClientFactory.create(advisor=self.advisor2) self.client_account2 = ClientAccountFactory.create( primary_owner=self.betasmartz_client2) self.goal3 = GoalFactory.create(account=self.client_account2) # add some more fees self.fee2 = TransactionFactory.create( reason=Transaction.REASON_FEE, status=Transaction.STATUS_EXECUTED, to_goal=self.goal3, amount=800, executed=self.older_fiscal_year.begin_date + relativedelta(months=1))
def setUp(self): self.client = ClientFactory.create(user=UserFactory.create()) self.pricing_plan = self.client.advisor.firm.pricing_plan self.pricing_plan.bps = 100 self.pricing_plan.fixed = 50 self.pricing_plan.system_fee = 10, 5 self.pricing_plan.save()
def setUp(self): self.support_group = GroupFactory(name=GROUP_SUPPORT_STAFF) # client with some personal assets, cash balance and goals self.region = RegionFactory.create() self.betasmartz_client_address = AddressFactory(region=self.region) self.risk_group = RiskProfileGroupFactory.create(name='Personal Risk Profile Group') self.personal_account_type = AccountTypeRiskProfileGroupFactory.create(account_type=0, risk_profile_group=self.risk_group) self.user = UserFactory.create() self.betasmartz_client = ClientFactory.create(user=self.user) self.betasmartz_client_account = ClientAccountFactory(primary_owner=self.betasmartz_client, account_type=ACCOUNT_TYPE_PERSONAL) self.external_asset1 = ExternalAssetFactory.create(owner=self.betasmartz_client) self.external_asset2 = ExternalAssetFactory.create(owner=self.betasmartz_client) self.goal1 = GoalFactory.create(account=self.betasmartz_client_account) self.goal2 = GoalFactory.create(account=self.betasmartz_client_account) self.betasmartz_client2 = ClientFactory.create()
def test_get_firm_analytics_worth_and_risk_filter(self): # /firm/analytics?worth=affluent&risk=0&risk=20&advisor=&client= url = reverse('firm:analytics') + '?worth=affluent&risk=0&risk=20&advisor=&client=' rep = AuthorisedRepresentativeFactory.create(firm=self.firm) advisor = AdvisorFactory.create(firm=self.firm) aclient = ClientFactory.create(advisor=advisor) aaccount = ClientAccountFactory.create(primary_owner=aclient) goal = GoalFactory.create(account=aaccount) self.client.login(username=rep.user.email, password='******') response = self.client.get(url) self.assertEqual(response.status_code, status.HTTP_200_OK)
def setUp(self): self.support_group = GroupFactory(name=GROUP_SUPPORT_STAFF) self.account = ClientAccountFactory.create() self.advisor = self.account.primary_owner.advisor self.firm = self.advisor.firm self.advisor2 = AdvisorFactory.create(firm=self.firm) self.betasmartz_client2 = ClientFactory.create(advisor=self.advisor2) self.account2 = ClientAccountFactory.create( primary_owner=self.betasmartz_client2) self.account_group = AccountGroupFactory.create(advisor=self.advisor) self.account_group2 = AccountGroupFactory.create(advisor=self.advisor2) self.account.account_group = self.account_group self.account.save() self.account2.account_group = self.account_group2 self.account2.save() self.rep = AuthorisedRepresentativeFactory.create(firm=self.firm)
def setUp(self): # employed, client over 50 years old self.betasmartz_client = ClientFactory.create( employment_status=constants.EMPLOYMENT_STATUS_EMMPLOYED, date_of_birth=datetime.now().date() - relativedelta(years=60)) self.betasmartz_client.regional_data['tax_transcript_data'] = { 'sections': [{ 'name': 'Introduction', 'fields': { 'SPOUSE NAME': 'SPOUSE M LAST', 'SPOUSE SSN': '222-22-2222', 'ADDRESS': '999 AVENUE RD CITY, ST 10.000-90.00-800', 'NAME': 'FIRST M', 'SSN': '111-11-1111', 'FILING STATUS': 'Single' } }, { 'name': 'Income', 'fields': { 'TOTAL INCOME': '$0.00' } }] } self.betasmartz_client.save() # personal account self.account = ClientAccountFactory.create( primary_owner=self.betasmartz_client) self.plan = RetirementPlanFactory.create(client=self.betasmartz_client) self.plan_account = RetirementPlanAccountFactory.create( plan=self.plan, account=self.account) # 401k self.account2 = ClientAccountFactory.create( primary_owner=self.betasmartz_client, account_type=constants.ACCOUNT_TYPE_401K) self.plan2 = RetirementPlanFactory.create( client=self.betasmartz_client, income=100000, max_employer_match_percent=.05) self.plan_account2 = RetirementPlanAccountFactory.create( plan=self.plan2, account=self.account2) # roth IRA self.account5 = ClientAccountFactory.create( primary_owner=self.betasmartz_client, account_type=constants.ACCOUNT_TYPE_ROTHIRA) self.plan5 = RetirementPlanFactory.create( client=self.betasmartz_client, income=100000, max_employer_match_percent=.05) self.plan_account5 = RetirementPlanAccountFactory.create( plan=self.plan5, account=self.account5) # unemployed, client 40 years old self.unemployed_client = ClientFactory.create( employment_status=constants.EMPLOYMENT_STATUS_UNEMPLOYED, date_of_birth=datetime.now().date() - relativedelta(years=40)) self.unemployed_client.regional_data['tax_transcript_data'] = { 'sections': [{ 'name': 'Introduction', 'fields': { 'SPOUSE NAME': 'SPOUSE M LAST', 'SPOUSE SSN': '222-22-2222', 'ADDRESS': '999 AVENUE RD CITY, ST 10.000-90.00-800', 'NAME': 'FIRST M', 'SSN': '111-11-1111', 'FILING STATUS': 'Single' } }, { 'name': 'Income', 'fields': { 'TOTAL INCOME': '$0.00' } }] } self.unemployed_client.save() # personal account self.account3 = ClientAccountFactory.create( primary_owner=self.unemployed_client) self.plan3 = RetirementPlanFactory.create( client=self.unemployed_client) self.plan_account3 = RetirementPlanAccountFactory.create( plan=self.plan3, account=self.account3) # employed, client over 50 years old, 150k+ income self.betasmartz_client2 = ClientFactory.create( employment_status=constants.EMPLOYMENT_STATUS_EMMPLOYED, date_of_birth=datetime.now().date() - relativedelta(years=60)) self.betasmartz_client2.regional_data['tax_transcript_data'] = { 'sections': [{ 'name': 'Introduction', 'fields': { 'SPOUSE NAME': 'SPOUSE M LAST', 'SPOUSE SSN': '222-22-2222', 'ADDRESS': '999 AVENUE RD CITY, ST 10.000-90.00-800', 'NAME': 'FIRST M', 'SSN': '111-11-1111', 'FILING STATUS': 'Single' } }, { 'name': 'Income', 'fields': { 'TOTAL INCOME': '$0.00' } }] } self.betasmartz_client2.save() # personal account self.account6 = ClientAccountFactory.create( primary_owner=self.betasmartz_client2) self.plan6 = RetirementPlanFactory.create( client=self.betasmartz_client2, income=150000) self.plan_account6 = RetirementPlanAccountFactory.create( plan=self.plan6, account=self.account6) # 401k self.account7 = ClientAccountFactory.create( primary_owner=self.betasmartz_client2, account_type=constants.ACCOUNT_TYPE_401K) self.plan7 = RetirementPlanFactory.create( client=self.betasmartz_client2, income=150000, max_employer_match_percent=.05) self.plan_account7 = RetirementPlanAccountFactory.create( plan=self.plan7, account=self.account7) # roth IRA self.account8 = ClientAccountFactory.create( primary_owner=self.betasmartz_client2, account_type=constants.ACCOUNT_TYPE_ROTHIRA) self.plan8 = RetirementPlanFactory.create( client=self.betasmartz_client2, income=150000, max_employer_match_percent=.05) self.plan_account8 = RetirementPlanAccountFactory.create( plan=self.plan8, account=self.account8) # unemployed, client 40 years old 150k+ income self.unemployed_client2 = ClientFactory.create( employment_status=constants.EMPLOYMENT_STATUS_UNEMPLOYED, date_of_birth=datetime.now().date() - relativedelta(years=40)) self.unemployed_client2.regional_data['tax_transcript_data'] = { 'sections': [{ 'name': 'Introduction', 'fields': { 'SPOUSE NAME': 'SPOUSE M LAST', 'SPOUSE SSN': '222-22-2222', 'ADDRESS': '999 AVENUE RD CITY, ST 10.000-90.00-800', 'NAME': 'FIRST M', 'SSN': '111-11-1111', 'FILING STATUS': 'Single' } }, { 'name': 'Income', 'fields': { 'TOTAL INCOME': '$0.00' } }] } self.unemployed_client2.save() # personal account self.account9 = ClientAccountFactory.create( primary_owner=self.unemployed_client2) self.plan9 = RetirementPlanFactory.create( client=self.unemployed_client2, income=150000) self.plan_account9 = RetirementPlanAccountFactory.create( plan=self.plan9, account=self.account9)