Beispiel #1
0
    def test_issues_empty(self):
        """Test when issue is empty API call"""

        empty_issues = read_file('data/launchpad/launchpad_empty_issues')
        httpretty.register_uri(
            httpretty.GET,
            LAUNCHPAD_PACKAGE_PROJECT_URL +
            "?modified_since=1970-01-01T00%3A00%3A00%2B00%3A00&ws.op=searchTasks"
            "&omit_duplicates=false&order_by=date_last_updated&status=Confirmed&status=Expired"
            "&status=Fix+Committed&status=Fix+Released"
            "&status=In+Progress&status=Incomplete&status=Incomplete+%28with+response%29"
            "&status=Incomplete+%28without+response%29"
            "&status=Invalid&status=New&status=Opinion&status=Triaged"
            "&status=Won%27t+Fix"
            "&ws.size=1&ws.start=0",
            body=empty_issues,
            status=200)

        client = LaunchpadClient("mydistribution",
                                 consumer_key=CONSUMER_KEY,
                                 api_token=OAUTH_TOKEN,
                                 package="mypackage")
        issues = [issues for issues in client.issues()]

        self.assertDictEqual(json.loads(issues[0]), json.loads(empty_issues))
    def test_issues_from_date(self):
        """Test issues from date API call"""

        # this method cannot be tested, because the next page is encoded
        # in the HTTP response (and not in the query string)
        issues_page_1 = read_file(
            'data/launchpad/launchpad_issues_page_1_no_next')
        httpretty.register_uri(
            httpretty.GET,
            LAUNCHPAD_PACKAGE_PROJECT_URL +
            "?modified_since=2017-08-21T16%3A00%3A00%2B00%3A00&ws.op=searchTasks"
            "&omit_duplicates=false&order_by=date_last_updated&status=Confirmed&status=Expired"
            "&status=Fix+Committed&status=Fix+Released"
            "&status=In+Progress&status=Incomplete&status=Incomplete+%28with+response%29"
            "&status=Incomplete+%28without+response%29"
            "&status=Invalid&status=New&status=Opinion&status=Triaged"
            "&status=Won%27t+Fix"
            "&ws.size=1&ws.start=0",
            body=issues_page_1,
            status=200)

        client = LaunchpadClient("mydistribution",
                                 package='mypackage',
                                 items_per_page=2)
        from_date = datetime.datetime(2018, 8, 21, 16, 0, 0)
        issues = [issues for issues in client.issues(start=from_date)]

        self.assertEqual(len(issues), 1)
Beispiel #3
0
    def test_issues(self):
        """Test issues API call"""

        issues_page_1 = read_file('data/launchpad/launchpad_issues_page_1')
        issues_page_2 = read_file('data/launchpad/launchpad_issues_page_2')
        issues_page_3 = read_file('data/launchpad/launchpad_issues_page_3')

        httpretty.register_uri(
            httpretty.GET,
            LAUNCHPAD_PACKAGE_PROJECT_URL +
            "?modified_since=1970-01-01T00%3A00%3A00%2B00%3A00&ws.op=searchTasks"
            "&omit_duplicates=false&order_by=date_last_updated&status=Confirmed&status=Expired"
            "&status=Fix+Committed&status=Fix+Released"
            "&status=In+Progress&status=Incomplete&status=Incomplete+%28with+response%29"
            "&status=Incomplete+%28without+response%29"
            "&status=Invalid&status=New&status=Opinion&status=Triaged"
            "&status=Won%27t+Fix"
            "&ws.size=1&memo=2&ws.start=2",
            body=issues_page_3,
            status=200)
        httpretty.register_uri(
            httpretty.GET,
            LAUNCHPAD_PACKAGE_PROJECT_URL +
            "?modified_since=1970-01-01T00%3A00%3A00%2B00%3A00&ws.op=searchTasks"
            "&omit_duplicates=false&order_by=date_last_updated&status=Confirmed&status=Expired"
            "&status=Fix+Committed&status=Fix+Released"
            "&status=In+Progress&status=Incomplete&status=Incomplete+%28with+response%29"
            "&status=Incomplete+%28without+response%29"
            "&status=Invalid&status=New&status=Opinion&status=Triaged"
            "&status=Won%27t+Fix"
            "&ws.size=1&memo=1&ws.start=1",
            body=issues_page_2,
            status=200)
        httpretty.register_uri(
            httpretty.GET,
            LAUNCHPAD_PACKAGE_PROJECT_URL +
            "?modified_since=1970-01-01T00%3A00%3A00%2B00%3A00&ws.op=searchTasks"
            "&omit_duplicates=false&order_by=date_last_updated&status=Confirmed&status=Expired"
            "&status=Fix+Committed&status=Fix+Released"
            "&status=In+Progress&status=Incomplete&status=Incomplete+%28with+response%29"
            "&status=Incomplete+%28without+response%29"
            "&status=Invalid&status=New&status=Opinion&status=Triaged"
            "&status=Won%27t+Fix"
            "&ws.size=1&ws.start=0",
            body=issues_page_1,
            status=200)

        client = LaunchpadClient("mydistribution",
                                 consumer_key=CONSUMER_KEY,
                                 api_token=OAUTH_TOKEN,
                                 package="mypackage",
                                 items_per_page=2)
        issues = [issues for issues in client.issues()]

        self.assertEqual(len(issues), 3)