def test_partner_organization_has_partner_id(self):
     count = 5
     PartnerFactory.create_batch(count)
     with self.login(email=self.basic_user().email):
         response = self.client.get(self.url)
         [
             self.assertTrue(result.get('partner_id') > 0)
             for result in response.data['results']
         ]
Exemple #2
0
 def test_partner_created_no_created_at(self):
     partner = PartnerFactory()
     partner.created_at = None
     partner.save()
     with self.login(email=self.basic_user().email):
         url = reverse(OrganizationHistoryView.view_name,
                       args=[partner.organization.id])
         response = self.client.get(url)
         events = find_events(response.data["results"],
                              OrganizationCreatedEvent.EVENT_TYPE)
         self.assertEqual(1, len(events))
         self.assertEqual(DAWN_OF_TIME, events[0]["datetime"])
 def test_get_partner(self):
     count = 5
     partners = PartnerFactory.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(partner.organization)
             in response.data['results'] for partner in partners
         ])
Exemple #4
0
 def test_partner_options(self):
     organization = PartnerFactory().organization
     with self.login(email=self.basic_user().email):
         url = reverse(OrganizationDetailView.view_name,
                       args=[organization.id])
         response = self.client.options(url)
         assert response.status_code == 200
         get_options = response.data["actions"]["GET"]["properties"]
         assert_fields(PARTNER_GET_FIELDS, get_options)
         assert_fields_missing(STARTUP_ONLY_GET_FIELDS, get_options)
Exemple #5
0
 def test_get_partner(self):
     partner = PartnerFactory()
     with self.login(email=self.basic_user().email):
         url = reverse(OrganizationDetailView.view_name,
                       args=[partner.organization.id])
         response = self.client.get(url)
         assert response.data["name"] == partner.organization.name
         assert response.data["url_slug"] == partner.organization.url_slug
         assert (response.data["public_inquiry_email"] ==
                 partner.public_inquiry_email)
         assert response.data["is_startup"] is False
         assert response.data["is_partner"] is True
Exemple #6
0
 def test_partner_created_using_later_partner(self):
     prev_partner = PartnerFactory()
     prev_created_at = days_from_now(-10)
     prev_partner.created_at = prev_created_at
     prev_partner.save()
     partner = PartnerFactory()
     partner.created_at = None
     partner.save()
     next_partner = PartnerFactory()
     next_created_at = days_from_now(-2)
     next_partner.created_at = next_created_at
     next_partner.save()
     with self.login(email=self.basic_user().email):
         url = reverse(OrganizationHistoryView.view_name,
                       args=[partner.organization.id])
         response = self.client.get(url)
         events = find_events(response.data["results"],
                              OrganizationCreatedEvent.EVENT_TYPE)
         self.assertEqual(1, len(events))
         self.assertEqual(prev_created_at, events[0]["datetime"])
         self.assertEqual(next_created_at, events[0]["latest_datetime"])
 def test_str(self):
     partner = PartnerFactory()
     assert str(partner) == partner.name
 def test_partner_website_url_is_from_organization(self):
     partner = PartnerFactory()
     partner.website_url = 'http://test.com'
     self.assertEqual(partner.website_url, partner.organization.website_url)
 def test_partner_twitter_handle_is_from_organization(self):
     partner = PartnerFactory()
     partner.twitter_handle = 'partner'
     self.assertEqual(partner.twitter_handle,
                      partner.organization.twitter_handle)