def get_feed_timestamp(self, timestamp=None, forward=False, **kwargs): 'Return the endpoint arguments need to specify the direction and timestamp in the right format' date = timestamp_to_utc(timestamp) if kwargs.get('forward', False): return {'after': date} else: return {'before': date}
def get_feed_timestamp(self, timestamp=None, forward=False, **kwargs): "return the parameters we need to send to the Blogger API to get the specified date range" if forward: start_datetime = timestamp_to_utc(timestamp) end_datetime = "" time_params = { 'startDate': start_datetime, } else: start_datetime = "" end_datetime = timestamp_to_utc(timestamp) time_params = { 'endDate': end_datetime } return time_params
def fake_repo(self, force_public=False, force_private=False): owner = self.fake_mini_user() is_public = self.fake_public(force_public=force_public, force_private=force_private) repo_id = self.fake_id() name = self.fake_words(1) forks = random.randint(0, 100) watchers = random.randint(0, 100) repo = { 'id': repo_id, 'owner': owner, 'name': name, 'full_name': "%s/%s" % (owner['login'], name), 'description': self.fake_words(random.randint(5, 20)), 'private': not is_public, 'fork': bool(random.randint(0, 1)), 'url': "https://api.github.com/repos/%s/%s" % (owner['login'], name), 'html_url': "https://github.com/%s/%s" % (owner['login'], name), 'clone_url': "https://github.com/%s/%s.git" % (owner['login'], name), 'git_url': "git://github.com:%s/%s.git" % (owner['login'], name), 'ssh_url': "[email protected]:%s/%s.git" % (owner['login'], name), 'svn_url': "https://svn.github.com/%s/%s" % (owner['login'], name), 'mirror_url': "git://git.example.com/%s/%s" % (owner['login'], name), 'homepage': 'https://github.com', 'language': None, 'forks': forks, 'forks_count': forks, 'watchers': watchers, 'watchers_count': watchers, 'size': random.randint(0, 1000), 'master_branch': 'master', 'open_issues': 0, 'pushed_at': timestamp_to_utc(self.fake_timestamp()), 'created_at': timestamp_to_utc(self.fake_timestamp()), 'updated_at': timestamp_to_utc(self.fake_timestamp()), } return repo
def fake_gist(self, force_public=False, force_private=False): user = self.fake_mini_user() is_public = self.fake_public(force_public=force_public, force_private=force_private) gist_id = self.fake_id() gist = { 'url': "https://api.github.com/gists/%s" % self.fake_hex_string(20), 'id': gist_id, 'description': self.fake_words(random.randint(5, 20)), 'public': is_public, 'user': user, 'files': {}, 'comments': random.randint(0,100), 'created_at': timestamp_to_utc(self.fake_timestamp()), 'comments_url': "https://api.github.com/gists/%s/comments/" % self.fake_hex_string(20), 'html_url': "https://gist.github.com/%s" % gist_id, 'git_pull_url': "git://gist.github.com/%s.git" % gist_id, 'git_push_url': "[email protected]:%s.git" % gist_id, } return gist