def test_get_with_limit(self): count = 5 StartupFactory.create_batch(count) with self.login(email=self.basic_user().email): limit = 2 url = self.url + "?limit=%s" % limit response = self.client.get(url) assert response.data['count'] == count assert len(response.data['results']) == limit
def test_startup_organization_has_startup_id(self): count = 5 StartupFactory.create_batch(count) with self.login(email=self.basic_user().email): response = self.client.get(self.url) [ self.assertTrue(result.get('startup_id') > 0) for result in response.data['results'] ]
def test_organization_schema_endpoint(self): count = 5 StartupFactory.create_batch(count) response = '' with self.login(email=self.basic_user().email): url = reverse("organization") response = self.client.options(url) results = response.data["actions"]["GET"]["properties"]["results"] properties = results["item"]["properties"] self.assertEqual(ORGANIZATION_FIELDS.keys(), properties.keys())
def test_user_schema_endpoint(self): count = 5 StartupFactory.create_batch(count) response = '' with self.login(email=self.basic_user().email): url = reverse("user") response = self.client.options(url) results = response.data["actions"]["GET"]["properties"]["results"] properties = results["item"]["properties"] response_keys = set(properties.keys()) self.assertTrue(len(response_keys) > 0) self.assertFalse(response_keys - set(USER_FIELDS.keys()))
def test_get_startup(self): count = 5 startups = StartupFactory.create_batch(count) with self.login(email=self.basic_user().email): response = self.client.get(self.url) assert response.data['count'] == count assert all([ OrganizationListView.serialize(startup.organization) in response.data['results'] for startup in startups ])
def test_user_organization_schema_endpoint(self): count = 5 startups = StartupFactory.create_batch(count) response = '' with self.login(email=self.basic_user().email): url = reverse("user_organizations", args=[startups[0].user.pk]) response = self.client.options(url) response_json = json.loads(response.content) self.assertEqual( ORGANIZATION_USER_FIELDS.keys(), response_json["actions"]["GET"] ["properties"]["organizations"]["item"]["properties"].keys())
def setUp(self): # Many objects must be created to scaffold this thing Site.objects.create() _site = Site.objects.first() startup1, startup2 = StartupFactory.create_batch(2) startup1.high_resolution_logo = "hamsterdance.gif" startup1.save() JobPostingFactory(startup=startup1) JobPostingFactory(startup=startup2) self.program = ProgramFactory() _pss = ProgramStartupStatusFactory(program=self.program) StartupStatusFactory(startup=startup1, program_startup_status=_pss) StartupStatusFactory(startup=startup2, program_startup_status=_pss) SiteProgramAuthorizationFactory(site=_site, program=self.program) self.url = reverse("job_posting_list")