def setUp(self): super().setUp() # Disable marketing site password just to save us from having to mock the responses self.partner = factories.PartnerFactory( marketing_site_api_password=None) self.person = factories.PersonFactory(partner=self.partner, given_name='Person') self.target = factories.PersonFactory(partner=self.partner, given_name='Target') self.instructor1 = factories.PersonFactory(partner=self.partner, given_name='Instructor1') self.instructor2 = factories.PersonFactory(partner=self.partner, given_name='Instructor2') self.instructor3 = factories.PersonFactory(partner=self.partner, given_name='Instructor3') self.position = factories.PositionFactory(person=self.person) self.social1 = factories.PersonSocialNetworkFactory(person=self.person) self.social2 = factories.PersonSocialNetworkFactory(person=self.person) self.endorsement = factories.EndorsementFactory(endorser=self.person) self.course = factories.CourseFactory(partner=self.partner) self.courserun1 = factories.CourseRunFactory(course=self.course, staff=[ self.instructor1, self.person, self.instructor2, self.instructor3, ]) self.courserun2 = factories.CourseRunFactory(course=self.course, staff=[ self.instructor1, self.instructor2, self.person, self.instructor3, ]) self.program = factories.ProgramFactory(courses=[self.course], instructor_ordering=[ self.person, self.instructor1, self.instructor2, self.instructor3, ]) self.publisher_course = publisher_factories.CourseFactory() self.publisher_courserun1 = publisher_factories.CourseRunFactory( course=self.publisher_course, staff=[ self.person, self.instructor1, self.instructor2, self.instructor3, ]) self.publisher_courserun2 = publisher_factories.CourseRunFactory( course=self.publisher_course, staff=[ self.instructor1, self.instructor2, self.instructor3, self.person, ])
def test_unique_constraint(self): """Verify that a person-social-network does not allow multiple accounts for same social network. """ factories.PersonSocialNetworkFactory(person=self.person, type='facebook') with self.assertRaises(IntegrityError): factories.PersonSocialNetworkFactory(person=self.person, type='facebook')
def setUp(self): super(PersonSocialNetworkTests, self).setUp() self.network = factories.PersonSocialNetworkFactory() self.person = factories.PersonFactory()