Exemplo n.º 1
0
    def test_paged_ok(self):
        mocked_json_values = [
            mocked_api_results.get_result_value(result)
            for result in mocked_api_results.PAGED_API_RESULT
        ]

        mocked_status_codes = [
            mocked_api_results.get_result_status_code(result)
            for result in mocked_api_results.PAGED_API_RESULT
        ]

        mocked_api = self.paged_api_will_return(mocked_json_values, mocked_status_codes)

        for result, status_code in mocked_api.get_organizations_public_repositories("unused"):
            expected = mocked_api_results.get_result_value(
                mocked_api_results.STANDARD_API_RESULT
            )

            self.assertOk(status_code)
            self.assertEqual(result, expected)
Exemplo n.º 2
0
    def test_get_repository_contributors_ok(self):
        mocked_json_values = [
            mocked_api_results.get_result_value(result)
            for result in mocked_api_results.PAGED_API_RESULT
        ]

        mocked_status_codes = [
            mocked_api_results.get_result_status_code(result)
            for result in mocked_api_results.PAGED_API_RESULT
        ]

        mocked_api = self.paged_api_will_return(mocked_json_values, mocked_status_codes)

        for result, status_code in mocked_api.get_repository_contributors("unused", "unused"):
            expected = mocked_api_results.get_result_value(
                mocked_api_results.STANDARD_API_RESULT
            )

            self.assertOk(status_code)
            assert result == expected