Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Phabricator mock to have user agent set #107

Merged
merged 3 commits into from
Oct 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@

import asyncio
import collections
from configparser import ConfigParser
import json
import os.path
import tempfile
import urllib.parse
from contextlib import contextmanager
from datetime import datetime, timedelta
Expand Down Expand Up @@ -345,6 +347,17 @@ def mock_taskcluster():

class MockBuild(PhabricatorBuild):
def __init__(self, diff_id, repo_phid, revision_id, target_phid, diff):
config_file = tempfile.NamedTemporaryFile()
with open(config_file.name, "w") as f:
custom_conf = ConfigParser()
custom_conf.add_section("User-Agent")
custom_conf.set("User-Agent", "name", "libmozdata")
custom_conf.write(f)
f.seek(0)
from libmozdata import config

config.set_config(config.ConfigIni(config_file.name))

self.diff_id = diff_id
self.repo_phid = repo_phid
self.revision_id = revision_id
Expand Down