diff options
author | 2012-02-09 23:01:12 +0100 | |
---|---|---|
committer | 2012-02-09 23:01:12 +0100 | |
commit | 18a8ed35b0ff6eae1bacbe0220f38a102fe4e321 (patch) | |
tree | a6c51bc90d2494947ef53a66154a074c31992b85 /pygithub3/tests/utils/core.py | |
parent | Core tests (diff) | |
download | python-github3-18a8ed35b0ff6eae1bacbe0220f38a102fe4e321.tar.xz python-github3-18a8ed35b0ff6eae1bacbe0220f38a102fe4e321.zip |
Utils to tests
Diffstat (limited to 'pygithub3/tests/utils/core.py')
-rw-r--r-- | pygithub3/tests/utils/core.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/pygithub3/tests/utils/core.py b/pygithub3/tests/utils/core.py new file mode 100644 index 0000000..8d18732 --- /dev/null +++ b/pygithub3/tests/utils/core.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python +# -*- encoding: utf-8 -*- + +from .base import Mock, DummyRequest + +request = DummyRequest() +# Working without json but name it json-related to not confuse +json_content = [dict(name='dummy')] + + +def mock_paginate_github_in_GET(request, page): + def header(page): + return {'link': '<https://d.com/d?page=%s>; rel="last"' % page} + + def content(page): + if page >= 3: + return json_content + return json_content * 2 + + response = Mock() + response.headers = header(3) + response.content = content(page) + return response + + +def mock_no_paginate_github_in_GET(request, page): + response = Mock() + response.headers = {} + response.content = [json_content * 3] + return response |