コード例 #1
0
    def test_update_existing(self):
        '''Update existing instance with new information coming from popit'''

        # This means that if I run the task then it should update the persons
        # I'm running the weekly job by default
        update_all_popits.delay()

        persons_after_updating = list(self.writeitinstance.persons.all())
        self.assertNotEquals(self.previously_created_persons, persons_after_updating)
コード例 #2
0
    def test_update_existing(self):
        '''Update existing instance with new information coming from popit'''

        # This means that if I run the task then it should update the persons
        # I'm running the weekly job by default
        update_all_popits.delay()

        persons_after_updating = list(self.writeitinstance.persons.all())
        self.assertNotEquals(self.previously_created_persons,
                             persons_after_updating)
コード例 #3
0
    def test_it_does_not_autosync_if_disabled(self):
        '''If the instance has autosync disabled then it does not sync'''
        writeitinstance_popit_record = WriteitInstancePopitInstanceRecord.objects.get(
            writeitinstance=self.writeitinstance,
            popitapiinstance=self.popit_api_instance
        )
        # Periodicity = 0  means that it is never going to send anything
        writeitinstance_popit_record.periodicity = 0
        writeitinstance_popit_record.save()

        # The record has been set to autosync False
        update_all_popits.delay()
        # Loading new data
        persons_after_updating = list(self.writeitinstance.persons.all())
        # It should not have updated our writeit instance
        self.assertEquals(self.previously_created_persons, persons_after_updating)
コード例 #4
0
    def test_it_does_not_autosync_if_disabled(self):
        '''If the instance has autosync disabled then it does not sync'''
        writeitinstance_popit_record = WriteitInstancePopitInstanceRecord.objects.get(
            writeitinstance=self.writeitinstance,
            popitapiinstance=self.popit_api_instance)
        # Periodicity = 0  means that it is never going to send anything
        writeitinstance_popit_record.periodicity = 0
        writeitinstance_popit_record.save()

        # The record has been set to autosync False
        update_all_popits.delay()
        # Loading new data
        persons_after_updating = list(self.writeitinstance.persons.all())
        # It should not have updated our writeit instance
        self.assertEquals(self.previously_created_persons,
                          persons_after_updating)
コード例 #5
0
    def test_autosyncs_receiving_a_parameter_with_the_periodicity(self):
        '''It can receive a parameter refering to the periodicity'''
        writeitinstance_popit_record = WriteitInstancePopitInstanceRecord.objects.get(
            writeitinstance=self.writeitinstance,
            popitapiinstance=self.popit_api_instance
        )
        writeitinstance_popit_record.periodicity = '1D'  # Daily
        writeitinstance_popit_record.save()

        # Now because it is receiving the default value = '1W'
        # it should not pull anyone
        update_all_popits.delay()

        persons_after_updating = list(self.writeitinstance.persons.all())
        self.assertEquals(self.previously_created_persons, persons_after_updating)

        # But If I tell the runner that I'm running the daily
        # process then it should change it
        update_all_popits.delay(periodicity="1D")
        persons_after_updating = list(self.writeitinstance.persons.all())
        self.assertNotEquals(self.previously_created_persons, persons_after_updating)
コード例 #6
0
    def test_autosyncs_receiving_a_parameter_with_the_periodicity(self):
        '''It can receive a parameter refering to the periodicity'''
        writeitinstance_popit_record = WriteitInstancePopitInstanceRecord.objects.get(
            writeitinstance=self.writeitinstance,
            popitapiinstance=self.popit_api_instance)
        writeitinstance_popit_record.periodicity = '1D'  # Daily
        writeitinstance_popit_record.save()

        # Now because it is receiving the default value = '1W'
        # it should not pull anyone
        update_all_popits.delay()

        persons_after_updating = list(self.writeitinstance.persons.all())
        self.assertEquals(self.previously_created_persons,
                          persons_after_updating)

        # But If I tell the runner that I'm running the daily
        # process then it should change it
        update_all_popits.delay(periodicity="1D")
        persons_after_updating = list(self.writeitinstance.persons.all())
        self.assertNotEquals(self.previously_created_persons,
                             persons_after_updating)