def setUp(self): clean_db_datas() self.parent_organization = create_parent_organization() self.organization = create_organization() self.organization.save_parent_org(parent_org=self.parent_organization) self.org_members = [] self.org_members = create_multiple_organizations(10) self.organization_not_member = create_organization_not_member()
def setUpClass(cls): clean_db_datas() cls.owner = create_user('TestProvider', "Li", 'Wen', 'demo') staffs = [] for i in range(10): user_name = "".join(["Staff1_", str(i)]) first_name = "".join(["Test1_", str(i)]) user = create_user(user_name, first_name, 'S', 'demo', uklass=OfficeStaff) staffs.append(user) cls.staffs = staffs cls.organizations = create_multiple_organizations()
def setUp(self): clean_db_datas() self.user = create_user(get_random_username(),'yang','peng','demo') org_setting = OrganizationSetting(display_in_contact_list_tab=True) org_setting.save() self.org_type = OrganizationType(name="Test Org Type", organization_setting=org_setting, is_public=True) self.org_type.save() self.org = create_organization() staff = OfficeStaff() staff.user = self.user staff.office_lat = 0.0 staff.office_longit = 0.0 staff.save() self.staff = staff self.org_members = [] self.org_members = create_multiple_organizations(10)
def setUp(self): clean_db_datas() self.user = create_user(get_random_username(), 'yang', 'peng', 'demo') org_setting = OrganizationSetting(display_in_contact_list_tab=True) org_setting.save() self.org_type = OrganizationType(name="Test Org Type", organization_setting=org_setting, is_public=True) self.org_type.save() self.org = create_organization() staff = OfficeStaff() staff.user = self.user staff.office_lat = 0.0 staff.office_longit = 0.0 staff.save() self.staff = staff self.org_members = [] self.org_members = create_multiple_organizations(10)
def setUpClass(cls): clean_db_datas() cls.owner = create_user('TestProvider', "Li", 'Wen', 'demo') staffs = [] for i in range(10): user_name = "".join(["Staff1_", str(i)]) first_name = "".join(["Test1_", str(i)]) user = create_user(user_name, first_name, 'S', 'demo', uklass=OfficeStaff) staffs.append(user) cls.staffs = staffs cls.organizations = create_multiple_organizations() for ele in cls.staffs: do_toggle_favorite(cls.owner, 1, ele.user.id) # repeat add same object, # the function 'do_toggle_favorite' shouldn't raise error do_toggle_favorite(cls.owner, 1, ele.user.id) for ele in cls.organizations: do_toggle_favorite(cls.owner, 2, ele.id)
def test_how_many_instances(self): create_multiple_organizations(num=10, org_type=self.org_type) self.assertEqual(10, len(how_many_instances(self.org_type.id)))
def test_how_many_instances_empty(self): create_multiple_organizations() self.assertEqual(0, len(how_many_instances(self.org_type.id)))