Exemplo n.º 1
0
    def test_get_report_data_with_current_month(self):
        wrapper = WebtrendsAPIWrapper(username=auth.username,
                                      password=auth.password)

        # Get the id of a profile
        profiles = json.loads(wrapper.list_profiles().text)
        profile_id = profiles[0]["ID"]

        # Get the id of a report
        reports = json.loads(wrapper.list_reports(profile_id).text)
        report_id = reports[0]["ID"]

        # Test past month
        response = wrapper.get_report_data(profile_id,
                                           report_id,
                                           start_period="current_month-1",
                                           end_period="current_month")
        self.assertEqual(200, response.status_code)

        # Test past ten months
        response = wrapper.get_report_data(profile_id,
                                           report_id,
                                           start_period="current_month-10",
                                           end_period="current_month")
        self.assertEqual(200, response.status_code)
Exemplo n.º 2
0
    def test_get_report_data(self):
        wrapper = WebtrendsAPIWrapper(username=auth.username,
                                      password=auth.password)

        # Get the id of a profile
        profiles = json.loads(wrapper.list_profiles().text)
        profile_id = profiles[0]["ID"]

        # Get the id of a report
        reports = json.loads(wrapper.list_reports(profile_id).text)
        report_id = reports[0]["ID"]

        response = wrapper.get_report_data(profile_id, report_id)
        self.assertEqual(200, response.status_code)
Exemplo n.º 3
0
    def test_get_report_data_with_absolute_time(self):
        wrapper = WebtrendsAPIWrapper(username=auth.username,
                                      password=auth.password)

        # Get the id of a profile
        profiles = json.loads(wrapper.list_profiles().text)
        profile_id = profiles[0]["ID"]

        # Get the id of a report
        reports = json.loads(wrapper.list_reports(profile_id).text)
        report_id = reports[0]["ID"]

        # January 2016
        response = wrapper.get_report_data(profile_id,
                                           report_id,
                                           start_period="2016m01d01h00",
                                           end_period="2016m02d01h00")
        self.assertEqual(200, response.status_code)