Пример #1
0
 def setUp(self):
     options = {
         'property_id': 'UA-12573345-12',
         'client_id': 'd944d45c-9c92-46a2-97be-9ba07d922227',
     }
     self.connection = GoogleAnalytics(options)
     self.driver = Timing(options, self.connection)
Пример #2
0
class TestTiming(TestCase):

    def setUp(self):
        options = {
            'property_id': 'UA-12573345-12',
            'client_id': 'd944d45c-9c92-46a2-97be-9ba07d922227',
        }
        self.connection = GoogleAnalytics(options)
        self.driver = Timing(options, self.connection)

    def test_send(self):
        response = self.driver.send(
            category='testing',
            name='timing',
            time=123,
            label='seconds',
        )

        self.assertEqual(response.status_code, 200)
        self.assertIn('utc', response.json)
        self.assertIn('utv', response.json)
        self.assertIn('utt', response.json)
        self.assertIn('utl', response.json)