File: test_data_feed_ingestion.py

package info (click to toggle)
python-azure 20201208%2Bgit-6
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,437,920 kB
  • sloc: python: 4,287,452; javascript: 269; makefile: 198; sh: 187; xml: 106
file content (57 lines) | stat: -rw-r--r-- 2,310 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# coding=utf-8
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------

import datetime
from dateutil.tz import tzutc
import pytest
from base_testcase import TestMetricsAdvisorAdministrationClientBase


class TestMetricsAdvisorAdministrationClient(TestMetricsAdvisorAdministrationClientBase):

    def test_get_data_feed_ingestion_progress(self):

        ingestion = self.admin_client.get_data_feed_ingestion_progress(
            data_feed_id=self.data_feed_id
        )
        self.assertIsNotNone(ingestion.latest_success_timestamp)
        self.assertIsNotNone(ingestion.latest_active_timestamp)

    def test_list_data_feed_ingestion_status(self):

        ingestions = self.admin_client.list_data_feed_ingestion_status(
            data_feed_id=self.data_feed_id,
            start_time=datetime.datetime(2020, 8, 9, tzinfo=tzutc()),
            end_time=datetime.datetime(2020, 9, 16, tzinfo=tzutc()),
        )
        assert len(list(ingestions)) > 0

    def test_list_data_feed_ingestion_status_with_skip(self):

        ingestions = self.admin_client.list_data_feed_ingestion_status(
            data_feed_id=self.data_feed_id,
            start_time=datetime.datetime(2020, 8, 9, tzinfo=tzutc()),
            end_time=datetime.datetime(2020, 9, 16, tzinfo=tzutc()),
        )

        ingestions_with_skips = self.admin_client.list_data_feed_ingestion_status(
            data_feed_id=self.data_feed_id,
            start_time=datetime.datetime(2020, 8, 9, tzinfo=tzutc()),
            end_time=datetime.datetime(2020, 9, 16, tzinfo=tzutc()),
            skip=5
        )
        ingestions_list = list(ingestions)
        ingestions_with_skips_list = list(ingestions_with_skips)
        assert len(ingestions_list) == len(ingestions_with_skips_list) + 5

    def test_refresh_data_feed_ingestion(self):
        self.admin_client.refresh_data_feed_ingestion(
            self.data_feed_id,
            start_time=datetime.datetime(2020, 10, 1, tzinfo=tzutc()),
            end_time=datetime.datetime(2020, 10, 2, tzinfo=tzutc()),
        )