def test_is_make_sense__no_building(self):

        VotePrototype.create(self.account2, self.bill,
                             relations.VOTE_TYPE.AGAINST)
        VotePrototype.create(self.account3, self.bill, relations.VOTE_TYPE.FOR)

        noun = names.generator().get_test_name('r-building-name')

        data = {
            'person': self.person_1.id,
            'chronicle_on_accepted': 'chronicle-accepted-1',
            'caption': 'bill-caption'
        }
        data.update(linguistics_helpers.get_word_post_data(noun,
                                                           prefix='name'))
        data['approved'] = True

        form = self.bill.data.get_moderator_form_update(data)

        self.assertTrue(form.is_valid())
        self.bill.update_by_moderator(form)

        places_logic.destroy_building(self.building)

        self.assertFalse(self.bill.has_meaning())
    def test_no_building(self):

        VotePrototype.create(self.account2, self.bill,
                             relations.VOTE_TYPE.AGAINST)
        VotePrototype.create(self.account3, self.bill, relations.VOTE_TYPE.FOR)

        noun = names.generator().get_test_name('r-building-name')

        data = {
            'person': self.person_1.id,
            'chronicle_on_accepted': 'chronicle-accepted-1',
            'caption': 'bill-caption'
        }
        data.update(linguistics_helpers.get_word_post_data(noun,
                                                           prefix='name'))
        data['approved'] = True

        form = self.bill.data.get_moderator_form_update(data)

        self.assertTrue(form.is_valid())
        self.bill.update_by_moderator(form)

        places_logic.destroy_building(self.building)

        self.assertTrue(self.bill.apply())

        self.assertEqual(
            Building.objects.filter(state=BUILDING_STATE.WORKING).count(), 1)

        building = places_logic.load_building(self.building.id)

        self.assertEqual(building.name, 'building-name-нс,ед,им')
    def test_has_meaning__no_building(self):
        self.assertEqual(Building.objects.filter(state=BUILDING_STATE.WORKING).count(), 2)

        VotePrototype.create(self.account2, self.bill, relations.VOTE_TYPE.AGAINST)
        VotePrototype.create(self.account3, self.bill, relations.VOTE_TYPE.FOR)

        data = self.bill.user_form_initials
        data['approved'] = True
        form = self.bill.data.get_moderator_form_update(data)

        self.assertTrue(form.is_valid())
        self.bill.update_by_moderator(form)

        places_logic.destroy_building(self.building_1)

        self.assertFalse(self.bill.has_meaning())
Example #4
0
 def apply(self, bill=None):
     if self.has_meaning():
         places_logic.destroy_building(self.building)