Beispiel #1
0
    def setUp(self):
        super(SynchronizerTest, self).setUp()

        connection.cursor().execute(CREATE_TABLE)

        self.synchronizer = Synchronizer(calendar_id='primary',
                                         transformer=TestTransformer())
Beispiel #2
0
    def setUp(self):
        super(SynchronizerTest, self).setUp()
        connection.cursor().execute("DROP TABLE gcalsync_testevent")
        connection.cursor().execute(CREATE_TABLE)

        self.synchronizer = Synchronizer(calendar_id='primary', 
            transformer=TestTransformer())
Beispiel #3
0
class SynchronizerTest(TestCase):
    def setUp(self):
        super(SynchronizerTest, self).setUp()

        connection.cursor().execute(CREATE_TABLE)

        self.synchronizer = Synchronizer(calendar_id='primary',
                                         transformer=TestTransformer())

    def tearDown(self):
        connection.cursor().execute("DROP TABLE gcalsync_testevent")

    def test_transform(self):
        model_data = self.synchronizer.get_model_data(sample_event_data)
        self.assertEqual(model_data['title'], sample_event_data['summary'])

    def test_extract_gcal_data(self):
        model_data = self.synchronizer.get_model_data(sample_event_data)
        gcal_event_id, gcal_event_url = self.synchronizer.extract_gcal_data(
            model_data)
        self.assertEqual(gcal_event_id, sample_event_data['id'])
        self.assertEqual(gcal_event_url, sample_event_data['htmlLink'])

    def test_create_synced_event(self):
        model_data = self.synchronizer.get_model_data(sample_event_data)
        gcal_event_id, gcal_event_url = self.synchronizer.extract_gcal_data(
            model_data)
        synced_event = self.synchronizer.create_synced_event(
            gcal_event_id, model_data)

        self.assertEqual(synced_event.gcal_event_id, gcal_event_id)
        self.assertEqual(synced_event.content_object.title,
                         sample_event_data['summary'])
Beispiel #4
0
class SynchronizerTest(TestCase):
    def setUp(self):
        super(SynchronizerTest, self).setUp()
        connection.cursor().execute("DROP TABLE gcalsync_testevent")
        connection.cursor().execute(CREATE_TABLE)

        self.synchronizer = Synchronizer(calendar_id='primary', 
            transformer=TestTransformer())

    def tearDown(self):
        connection.cursor().execute("DROP TABLE gcalsync_testevent")

    def test_transform(self):
        model_data = self.synchronizer.get_model_data(sample_event_data)
        self.assertEqual(model_data['title'], sample_event_data['summary'])

    def test_extract_gcal_data(self):
        model_data = self.synchronizer.get_model_data(sample_event_data)
        gcal_event_id, gcal_event_url = self.synchronizer.extract_gcal_data(model_data)
        self.assertEqual(gcal_event_id, sample_event_data['id'])
        self.assertEqual(gcal_event_url, sample_event_data['htmlLink'])

    def test_create_synced_event(self):
        model_data = self.synchronizer.get_model_data(sample_event_data)
        gcal_event_id, gcal_event_url = self.synchronizer.extract_gcal_data(model_data)
        synced_event = self.synchronizer.create_synced_event(gcal_event_id, model_data)

        self.assertEqual(synced_event.gcal_event_id, gcal_event_id)
        self.assertEqual(synced_event.content_object.title, sample_event_data['summary'])
Beispiel #5
0
def transform():
    synchronizer = Synchronizer(calendar_id=settings.GCALSYNC_CALENDAR, transformer=EventTransformer())
    synchronizer.sync()