Пример #1
0
 def test_challenge_has_added_board(self):
     Factory.tag(self.a1, name="Board of Directors")
     bg = Factory.group(self.a1,"board of directors")
     Factory.grouprule(self.a1, "have any tag that","contains","Board of Directors", group=bg)
     Factory.tag_person(self.a1, tag_name="Board of Directors")
     self.a1.check_challenge_progress()
     assert self.a1.challenge_has_added_board == True
Пример #2
0
    def test_that_requesting_an_invalid_group_404s(self):
        sel = self.selenium
        self.go_to_the_login_page()
        self.log_in()
        self.assert_login_succeeded()
        # make sure to make a new person
        for i in range(0,10):
            Factory.group(account=self.a1)
        self.create_new_group()
        # get pk
        url = sel.get_location()
        url = url[url.find(":%s/" % settings.LIVE_SERVER_PORT)+5:]

        a2 = self.create_demo_site("test2")
        ua = Factory.useraccount(account=a2)
        self.go_to_the_login_page(site="test2")
        self.log_in(ua=ua)
        self.open(url, site="test2")
        time.sleep(10)
        assert sel.is_text_present("not found")
Пример #3
0
    def test_invalid_rule_missing_operator_side(self):
        right_hand_term="test"
        # operator_name="contains"
        group = Factory.group(self.account)
        left_side = LeftSide.objects_by_account(self.account).get(display_name="have a General tag that")
        # icontains = Operator.objects_by_account(self.account).get(display_name=operator_name)
        icontains = None
        rst = self._text_right_side_types[0]
        rsv = right_hand_term
        GroupRule.raw_objects.create(account=self.account, group=group, left_side=left_side, operator=icontains, right_side_value=rsv, right_side_type=rst)

        self.assertEqual(group.has_a_valid_rule, False)
Пример #4
0
    def test_create_new_group_rule_for_general_tag_contains(self, right_hand_term="test", operator_name="contains"):
        # create a new group rule
        group = Factory.group(self.account)
        left_side = LeftSide.objects_by_account(self.account).get(display_name="have a General tag that")
        icontains = Operator.objects_by_account(self.account).get(display_name=operator_name)
        rst = self._text_right_side_types[0]
        rsv = right_hand_term
        group_rule = GroupRule.raw_objects.create(account=self.account, group=group, left_side=left_side, operator=icontains, right_side_value=rsv, right_side_type=rst)
        new_group_rule = GroupRule.objects_by_account(self.account).get(pk=group_rule.pk)

        # assert the correct models exist
        self.assertEqual(new_group_rule.group, group)
        self.assertEqual(new_group_rule.left_side, left_side)
        self.assertEqual(new_group_rule.operator, icontains)
        self.assertEqual(new_group_rule.right_side_value, rsv)
        self.assertEqual(new_group_rule.group, group)

        return group, new_group_rule
Пример #5
0
    def test_create_new_group_rule_for_volunteer_status_is_inactive(self, right_hand_term="inactive", operator_name="is"):
        # create a new group 
        group = Factory.group(self.account)
        
        # create a new group rule
        left_side = LeftSide.objects_by_account(self.account).get(display_name="volunteer status")
        icontains = Operator.objects_by_account(self.account).get(display_name=operator_name)
        rst = self._choices_right_side_types[0]
        rsv = right_hand_term
        group_rule = GroupRule.raw_objects.create(account=self.account, group=group, left_side=left_side, operator=icontains, right_side_value=rsv, right_side_type=rst)
        new_group_rule = GroupRule.objects_by_account(self.account).get(pk=group_rule.pk)

        # assert the correct models exist
        self.assertEqual(new_group_rule.group, group)
        self.assertEqual(new_group_rule.left_side, left_side)
        self.assertEqual(new_group_rule.operator, icontains)
        self.assertEqual(new_group_rule.right_side_value, rsv)
        self.assertEqual(new_group_rule.group, group)

        return group, new_group_rule
Пример #6
0
    def test_create_new_group_rule_for_last_donation_is_after(self, right_hand_term="2/12/2009", operator_name="is after"):
       # create a new group 
        group = Factory.group(self.account)
        
        # create a new group rule
        left_side = LeftSide.objects_by_account(self.account).get(display_name="last donation")
        op = Operator.objects_by_account(self.account).get(display_name=operator_name)
        rst = self._date_right_side_types[0]
        rsv = right_hand_term
        group_rule = GroupRule.raw_objects.create(account=self.account, group=group, left_side=left_side, operator=op, right_side_value=rsv, right_side_type=rst)
        new_group_rule = GroupRule.objects_by_account(self.account).get(pk=group_rule.pk)

        # assert the correct models exist
        self.assertEqual(new_group_rule.group, group)
        self.assertEqual(new_group_rule.left_side, left_side)
        self.assertEqual(new_group_rule.operator, op)
        self.assertEqual(new_group_rule.right_side_value, rsv)
        self.assertEqual(new_group_rule.group, group)

        return group, new_group_rule
Пример #7
0
    def test_create_new_group_rule_for_custom_tag_is_exactly(self, right_hand_term="test", operator_name="is exactly"):
        # create a new group 
        group = Factory.group(self.account)
        
        # make the custom tag
        TagSet.raw_objects.get_or_create(account=self.account, name="new test tagset")
        populate_rule_components_for_an_account(self.account)
        # create a new group rule
        left_side = LeftSide.objects_by_account(self.account).get(display_name="have a new test tagset tag that")
        icontains = Operator.objects_by_account(self.account).get(display_name=operator_name)
        rst = self._text_right_side_types[0]
        rsv = right_hand_term
        group_rule = GroupRule.raw_objects.create(account=self.account, group=group, left_side=left_side, operator=icontains, right_side_value=rsv, right_side_type=rst)
        new_group_rule = GroupRule.objects_by_account(self.account).get(pk=group_rule.pk)

        # assert the correct models exist
        self.assertEqual(new_group_rule.group, group)
        self.assertEqual(new_group_rule.left_side, left_side)
        self.assertEqual(new_group_rule.operator, icontains)
        self.assertEqual(new_group_rule.right_side_value, rsv)
        self.assertEqual(new_group_rule.group, group)

        return group, new_group_rule