Esempio n. 1
0
 def testExport(self):
     event_dict = self.eventDict.copy()
     # event_dict.pop("locationRef")
     b = FbEventBuilder()
     b.build_with_fb_dict(self.fbDict)
     e = b.export_as_class(SocialEvent)
     self.assertDictContainsSubset(event_dict, e.to_dict())
Esempio n. 2
0
 def test_start_time_local(self):
     b = FbEventBuilder()
     b._build_start_time(self.fb_dict)
     targets = b._event_dict["targets"]
     self.assertIn(
         {
             'eventCategory': 'social',
             'toEvent': True,
             'arriveAtEventTime': {
                 'earliest': 1555077600,
                 'latest': 1555088400
             }
         }, targets)
Esempio n. 3
0
    def test_end_time_local(self):

        b = FbEventBuilder()
        b._build_end_time(self.fb_dict)
        targets = b._event_dict["targets"]
        self.assertIn(
            {
                'eventCategory': 'social',
                'toEvent': False,
                'leaveEventTime': {
                    'earliest': 1555318740,
                    'latest': 1555329540
                }
            }, targets)
Esempio n. 4
0
    def testBuildDict(self):
        """
        TODO: write expected_d
        :return:
        """
        userId = 'testuserid1'
        # d = FormDictFactory().create(hasEarliestLatest=False, returnDict=True)

        b = FbEventBuilder()
        b.build_with_fb_dict(self.fbDict)

        expected_d = self.eventDict

        self.assertIsNotNone(b._event_dict["locationRef"].id)

        print(b._event_dict)

        # Assert that all required variables are set
        self.assertDictContainsSubset(expected_d, b._event_dict)
Esempio n. 5
0
 def test_fb_event_id(self):
     b = FbEventBuilder()
     b._build_fb_event_id(self.fb_dict)
     self.assertEqual(b._event_dict["fbEventId"], "137943263736990")