Пример #1
0
    def test_ranked_inf_report(self, m):
        """ Make sure the ranked report is being processed
        """

        path = os.path.dirname(__file__)

        with open(path + '/mock_objects/ranked_report_inf.json') as data_file:
            json_response = data_file.read()

        with open(path + '/mock_objects/Report.Queue.json') as queue_file:
            report_queue = queue_file.read()

        #setup mock object
        m.post('https://api.omniture.com/admin/1.4/rest/?method=Report.Get',
               text=json_response)
        m.post('https://api.omniture.com/admin/1.4/rest/?method=Report.Queue',
               text=report_queue)

        ranked = self.analytics.suites[test_report_suite].report.element(
            "page").metric("pageviews").metric("visits")
        queue = []
        queue.append(ranked)
        response = omniture.sync(queue)

        for report in response:
            #Check Data

            self.assertEqual(report.data[-1]["visits"], 0)
            self.assertEqual(report.data[-1]["pageviews"], 0)
Пример #2
0
    def test_ranked_inf_report(self, m):
        """ Make sure the ranked report is being processed
        """

        path = os.path.dirname(__file__)

        with open(path+'/mock_objects/ranked_report_inf.json') as data_file:
            json_response = data_file.read()

        with open(path+'/mock_objects/Report.Queue.json') as queue_file:
            report_queue = queue_file.read()

        #setup mock object
        m.post('https://api.omniture.com/admin/1.4/rest/?method=Report.Get', text=json_response)
        m.post('https://api.omniture.com/admin/1.4/rest/?method=Report.Queue', text=report_queue)

        ranked = self.analytics.suites[test_report_suite].report.element("page").metric("pageviews").metric("visits")
        queue = []
        queue.append(ranked)
        response = omniture.sync(queue)

        for report in response:
            #Check Data

            self.assertEqual(report.data[-1]["visits"], 0)
            self.assertEqual(report.data[-1]["pageviews"], 0)    
Пример #3
0
    def test_ranked_report(self, m):
        """ Make sure the ranked report is being processed
        """

        path = os.path.dirname(__file__)

        with open(path+'/mock_objects/ranked_report.json') as data_file:
            json_response = data_file.read()

        with open(path+'/mock_objects/Report.Queue.json') as queue_file:
            report_queue = queue_file.read()

        #setup mock object
        m.post('https://api.omniture.com/admin/1.4/rest/?method=Report.Get', text=json_response)
        m.post('https://api.omniture.com/admin/1.4/rest/?method=Report.Queue', text=report_queue)

        ranked = self.analytics.suites[test_report_suite].report.element("page").metric("pageviews").metric("visits")
        queue = []
        queue.append(ranked)
        response = omniture.sync(queue)

        for report in response:
            #Check Data
            self.assertIsInstance(report.data, list, "Data isn't getting populated right")
            self.assertIsInstance(report.data[0] , dict, "The data isn't getting into the dict")
            self.assertIsInstance(report.data[0]['page'], str, "The page isn't getting populated in the data")
            self.assertIsInstance(report.data[0]['pageviews'], int, "The pageviews aren't getting populated in the data")
            self.assertIsInstance(report.data[0]['visits'], int, "The visits aren't getting populated in the data")
Пример #4
0
    def test_ranked_report(self, m):
        """ Make sure the ranked report is being processed
        """

        path = os.path.dirname(__file__)

        with open(path+'/mock_objects/ranked_report.json') as data_file:
            json_response = data_file.read()

        with open(path+'/mock_objects/Report.Queue.json') as queue_file:
            report_queue = queue_file.read()

        #setup mock object
        m.post('https://api.omniture.com/admin/1.4/rest/?method=Report.Get', text=json_response)
        m.post('https://api.omniture.com/admin/1.4/rest/?method=Report.Queue', text=report_queue)

        ranked = self.analytics.suites[test_report_suite].report.element("page").metric("pageviews").metric("visits")
        queue = []
        queue.append(ranked)
        response = omniture.sync(queue)

        for report in response:
            #Check Data
            self.assertIsInstance(report.data, list, "Data isn't getting populated right")
            self.assertIsInstance(report.data[0] , dict, "The data isn't getting into the dict")
            self.assertIsInstance(report.data[0]['page'], str, "The page isn't getting populated in the data")
            self.assertIsInstance(report.data[0]['pageviews'], int, "The pageviews aren't getting populated in the data")
            self.assertIsInstance(report.data[0]['visits'], int, "The visits aren't getting populated in the data")
 def test_basic_report(self):
     """ Make sure a basic report can be run
     """
     report = self.analytics.suites[0].report
     queue = []
     queue.append(report)
     response = omniture.sync(queue)
     self.assertIsInstance(response, list)
Пример #6
0
 def test_anamoly_detection(self):
     basic_report = self.analytics.suites[test_suite].report.metric("pageviews").range(dateFrom, dateTo).anomaly_detection()
     queue = []
     queue.append(basic_report)
     response = omniture.sync(queue)
     
     for report in response:
         self.assertEqual(report.metrics, "upper bound" ,"Anomaly Detection isn't working")
Пример #7
0
 def test_basic_report(self):
     """ Make sure a basic report can be run
     """
     report = self.analytics.suites[test_report_suite].report
     queue = []
     queue.append(report)
     response = omniture.sync(queue)
     self.assertIsInstance(response, list)
Пример #8
0
    def test_anamoly_detection(self):
        basic_report = self.analytics.suites[test_suite].report.metric(
            "pageviews").range(dateFrom, dateTo).anomaly_detection()
        queue = []
        queue.append(basic_report)
        response = omniture.sync(queue)

        for report in response:
            self.assertEqual(report.metrics, "upper bound",
                             "Anomaly Detection isn't working")
Пример #9
0
    def test_ranked(self):
        basic_report = self.analytics.suites[test_suite].report.element("page")
        queue = []
        queue.append(basic_report)
        response = omniture.sync(queue)

        for report in response:
            self.assertEqual(report.elements[0].id, "page", "The element is wrong")
            self.assertEqual(len(report.elements), 1, "There are too many elements")
            self.assertEqual(report.type, "ranked", "This is the wrong type of report it should be ranked")
Пример #10
0
 def test_double_element(self):
     basic_report = self.analytics.suites[test_suite].report.element("page").element("browser")
     queue = []
     queue.append(basic_report)
     response = omniture.sync(queue)
     
     for report in response:
         self.assertEqual(report.elements[0].id,"page", "The 1st element is wrong")
         self.assertEqual(report.elements[1].id,"browser", "The 2nd element is wrong")
         self.assertEqual(len(report.elements), 2, "The number of elements is wrong")
         self.assertEqual(report.type, "ranked", "This is the wrong type of report it should be ranked")
Пример #11
0
 def test_double_metric(self):
     basic_report = self.analytics.suites[test_suite].report.metric("pageviews").metric("visits")
     queue = []
     queue.append(basic_report)
     response = omniture.sync(queue)
     
     for report in response:
         self.assertEqual(report.metrics[0].id,"pageviews", "The 1st element is wrong")
         self.assertEqual(report.metrics[1].id,"visits", "The 2nd element is wrong")
         self.assertEqual(len(report.metrics), 2, "The number of elements is wrong")
         self.assertEqual(report.type, "overtime", "This is the wrong type of report it should be overtime")
Пример #12
0
 def test_element_paratmers(self):
     """Test the top and startingWith parameters
     This isn't a conclusive test. I really should run to two reports and compare the results to make sure it is corrent
     However, these tests need to be able run on any report suite and some reports suites (like ones that are currenly being 
     used) don't have 10 items in the page name
     """
     basic_report = self.analytics.suites[test_suite].report.element("page", top=5, startingWith=5)
     queue = []
     queue.append(basic_report)
     response = omniture.sync(queue)
     
     for report in response:
         self.assertEqual(report.elements['page'].id, "page" ,"The parameters might have screwed this up")
Пример #13
0
    def test_ranked(self):
        basic_report = self.analytics.suites[test_suite].report.element("page")
        queue = []
        queue.append(basic_report)
        response = omniture.sync(queue)

        for report in response:
            self.assertEqual(report.elements[0].id, "page",
                             "The element is wrong")
            self.assertEqual(len(report.elements), 1,
                             "There are too many elements")
            self.assertEqual(
                report.type, "ranked",
                "This is the wrong type of report it should be ranked")
Пример #14
0
    def test_element_paratmers(self):
        """Test the top and startingWith parameters
        This isn't a conclusive test. I really should run to two reports and compare the results to make sure it is corrent
        However, these tests need to be able run on any report suite and some reports suites (like ones that are currenly being 
        used) don't have 10 items in the page name
        """
        basic_report = self.analytics.suites[test_suite].report.element(
            "page", top=5, startingWith=5)
        queue = []
        queue.append(basic_report)
        response = omniture.sync(queue)

        for report in response:
            self.assertEqual(report.elements['page'].id, "page",
                             "The parameters might have screwed this up")
Пример #15
0
    def test_ranked_report(self):
        """ Make sure the ranked report is being processed
        """

        ranked = self.analytics.suites[test_report_suite].report.element("page").metric("pageviews").metric("visits")
        queue = []
        queue.append(ranked)
        response = omniture.sync(queue)

        for report in response:
            #Check Data
            self.assertIsInstance(report.data, list, "Data isn't getting populated right")
            self.assertIsInstance(report.data[0] , dict, "The data isn't getting into the dict")
            self.assertIsInstance(report.data[0]['page'], str, "The page isn't getting populated in the data")
            self.assertIsInstance(report.data[0]['pageviews'], int, "The pageviews aren't getting populated in the data")
            self.assertIsInstance(report.data[0]['visits'], int, "The visits aren't getting populated in the data")
Пример #16
0
    def test_double_metric(self):
        basic_report = self.analytics.suites[test_suite].report.metric(
            "pageviews").metric("visits")
        queue = []
        queue.append(basic_report)
        response = omniture.sync(queue)

        for report in response:
            self.assertEqual(report.metrics[0].id, "pageviews",
                             "The 1st element is wrong")
            self.assertEqual(report.metrics[1].id, "visits",
                             "The 2nd element is wrong")
            self.assertEqual(len(report.metrics), 2,
                             "The number of elements is wrong")
            self.assertEqual(
                report.type, "overtime",
                "This is the wrong type of report it should be overtime")
Пример #17
0
    def test_double_element(self):
        basic_report = self.analytics.suites[test_suite].report.element(
            "page").element("browser")
        queue = []
        queue.append(basic_report)
        response = omniture.sync(queue)

        for report in response:
            self.assertEqual(report.elements[0].id, "page",
                             "The 1st element is wrong")
            self.assertEqual(report.elements[1].id, "browser",
                             "The 2nd element is wrong")
            self.assertEqual(len(report.elements), 2,
                             "The number of elements is wrong")
            self.assertEqual(
                report.type, "ranked",
                "This is the wrong type of report it should be ranked")
Пример #18
0
network = analytics.suites['guardiangu-network']
print len(network.evars)
#pprint(network.segments)
print network.segments['First Time Visitors']

segments = [
    'UK (Locked)', 
    'US (Locked)',
    ]

queue = []

for segment in segments:
    report = network.report \
        .range('2013-05-01', '2013-05-31', granularity='day') \
        .over_time(metrics=['pageviews']) \
        .filter(segment=segment)

    queue.append(report)

def heartbeat():
    sys.stdout.write('.')
    sys.stdout.flush()

reports = omniture.sync(queue, heartbeat)

for report in reports:
    print report.segment
    print report.data['pageviews']

Пример #19
0
 def test_overtime(self):
     basic_report = self.analytics.suites[test_suite].report.metric(
         "orders").granularity("hour")
     queue = []
     queue.append(basic_report)
     response = omniture.sync(queue)
Пример #20
0
 def setUp(self):
     self.analytics = omniture.authenticate(creds['username'], creds['secret'])
     reportdef = self.analytics.suites[test_suite].report
     queue = []
     queue.append(reportdef)
     self.report = omniture.sync(queue)
Пример #21
0
 def test_overtime(self):
     basic_report = self.analytics.suites[test_suite].report.metric("orders").granularity("hour")
     queue = []
     queue.append(basic_report)
     response = omniture.sync(queue)
Пример #22
0
print len(network.evars)
#pprint(network.segments)
print network.segments['First Time Visitors']

segments = [
    'UK (Locked)',
    'US (Locked)',
]

queue = []

for segment in segments:
    report = network.report \
        .range('2013-05-01', '2013-05-31', granularity='day') \
        .over_time(metrics=['pageviews']) \
        .filter(segment=segment)

    queue.append(report)


def heartbeat():
    sys.stdout.write('.')
    sys.stdout.flush()


reports = omniture.sync(queue, heartbeat)

for report in reports:
    print report.segment
    print report.data['pageviews']