示例#1
0
 def setUp(self):
     self.user1 = get_user_model().objects.create_user('user1', '*****@*****.**', 'user1pass')
     self.user2 = get_user_model().objects.create_user('user2', '*****@*****.**', 'user2pass')
     self.metric1 = create_metric(name='Test Trending1', slug='test_trend1')
     self.metric2 = create_metric(name='Test Trending2', slug='test_trend2')
     self.set = create_metric_set(name="Fake Report",
                                  metrics=[self.metric1, self.metric2],
                                  email_recipients=[self.user1, self.user2])
示例#2
0
    def setUp(self):
        self.metric1 = create_metric(name='Test Aggregation1', slug='test_agg1')
        self.metric2 = create_metric(name='Test Aggregation2', slug='test_agg2')

        metric('test_agg1')
        metric('test_agg1')

        metric('test_agg2')
        metric('test_agg2')
        metric('test_agg2')
示例#3
0
    def test_metric(self):
        new_metric = create_metric(name='Test Metric Class',
                                   slug='test_metric')

        metric('test_metric')
        metric('test_metric')
        metric('test_metric')

        current_count = MetricItem.objects.filter(metric=new_metric)

        self.assertEqual(len(current_count), 3)
        self.assertEqual(current_count[0].num, 1)
        self.assertEqual(current_count[1].num, 1)
        self.assertEqual(current_count[2].num, 1)
示例#4
0
 def setUp(self):
     self.metric1 = create_metric(name='Test Trending1', slug='test_trend1')
     self.metric2 = create_metric(name='Test Trending2', slug='test_trend2')
示例#5
0
 def setUp(self):
     super(DisabledTests, self).setUp()
     self.old_disabled = getattr(settings, 'APP_METRICS_DISABLED', False)
     settings.APP_METRICS_DISABLED = True
     self.metric1 = create_metric(name='Test Disable', slug='test_disable')