def test_startup_became_entrant(self): program = ProgramFactory() cycle = program.cycle application = ApplicationFactory( application_status=SUBMITTED_APP_STATUS, application_type=cycle.default_application_type, cycle=cycle) startup = application.startup StartupProgramInterestFactory(startup=startup, program=program, applying=True) startup_status = StartupStatusFactory( startup=startup, program_startup_status__program=program, program_startup_status__startup_role__name=StartupRole.ENTRANT) startup_status.created_at = days_from_now(-1) startup_status.save() with self.login(email=self.basic_user().email): url = reverse(OrganizationHistoryView.view_name, args=[startup.organization.id]) response = self.client.get(url) events = find_events(response.data["results"], OrganizationBecameEntrantEvent.EVENT_TYPE) self.assertEqual(1, len(events)) self.assertTrue(cycle.name in events[0]["description"]) self.assertEqual(startup_status.created_at, events[0]["datetime"]) self.assertEqual(program.id, events[0]["program_id"]) self.assertEqual(program.name, events[0]["program"]) self.assertEqual(1, events[0]["program_preference"])
def test_startup_became_winner_no_created_at(self): startup = StartupFactory() end_date = days_from_now(-10) startup_status = StartupStatusFactory( program_startup_status__startup_role__name=StartupRole.GOLD_WINNER, program_startup_status__program__end_date=end_date, startup=startup) startup_status.created_at = None startup_status.save() with self.login(email=self.basic_user().email): url = reverse(OrganizationHistoryView.view_name, args=[startup.organization.id]) response = self.client.get(url) events = find_events(response.data["results"], OrganizationBecameWinnerEvent.EVENT_TYPE) self.assertEqual(1, len(events)) self.assertEqual(end_date, events[0]["datetime"])