コード例 #1
0
ファイル: test_api.py プロジェクト: stephrdev/django-didadata
 def test_created_with_timestamp(self):
     yesterday = timezone.now() - timedelta(days=1)
     metric = MetricFactory.create(name='my-metric')
     obj = api.record('my-metric', 23, timestamp=yesterday)
     assert obj.pk is not None
     assert metric.record_set.count() == 1
     assert obj.timestamp == yesterday
コード例 #2
0
ファイル: test_api.py プロジェクト: stephrdev/django-didadata
    def test_created_with_timestamp_invalid_format(self):
        yesterday = 'yesterday'
        MetricFactory.create(name='my-metric')

        with pytest.raises(ValidationError):
            api.record('my-metric', 23, timestamp=yesterday)
コード例 #3
0
ファイル: test_api.py プロジェクト: stephrdev/django-didadata
 def test_invalid_value(self):
     MetricFactory.create(name='my-metric')
     with pytest.raises(InvalidValueException):
         api.record('my-metric', 'foo')
コード例 #4
0
ファイル: test_api.py プロジェクト: stephrdev/django-didadata
 def test_created(self):
     metric = MetricFactory.create(name='my-metric')
     obj = api.record('my-metric', 23)
     assert obj.pk is not None
     assert metric.record_set.count() == 1
コード例 #5
0
ファイル: test_api.py プロジェクト: stephrdev/django-didadata
 def test_invalid_metric(self):
     with pytest.raises(MetricNotFoundException):
         api.record('my-metric', 0)