Skip to content

Commit

Permalink
Update Phabricator mock to have libmozdata User-Agent set (#107)
Browse files Browse the repository at this point in the history
  • Loading branch information
mlbonhomme authored Oct 23, 2024
1 parent 6973fde commit 02df27d
Showing 1 changed file with 13 additions and 0 deletions.
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

0 comments on commit 02df27d

Please sign in to comment.