Ejemplo n.º 1
0
 def mock_config(self):
     service_config = ServiceConfig()
     service_config.github_app_id = 123123
     service_config.github_app_cert_path = None
     service_config.github_token = "token"
     service_config.dry_run = False
     service_config.github_requests_log_path = "/path"
     ServiceConfig.service_config = service_config
Ejemplo n.º 2
0
 def mock_config(self):
     service_config = ServiceConfig()
     service_config.services = {
         GithubService(token="token"),
         GitlabService(token="token"),
     }
     service_config.dry_run = False
     service_config.github_requests_log_path = "/path"
     ServiceConfig.service_config = service_config
Ejemplo n.º 3
0
 def setup_class(cls):
     service_config = ServiceConfig()
     service_config.services = {
         GithubService(token="12345"),
         PagureService(instance_url="https://git.stg.centos.org",
                       token="6789"),
     }
     service_config.dry_run = False
     service_config.github_requests_log_path = "/path"
     ServiceConfig.service_config = service_config
Ejemplo n.º 4
0
 def f(path: str):
     """ path points to a file where the http communication will be saved """
     conf = ServiceConfig()
     # TODO: add pagure support
     # conf._pagure_user_token = os.environ.get("PAGURE_TOKEN", "test")
     # conf._pagure_fork_token = os.environ.get("PAGURE_FORK_TOKEN", "test")
     conf._github_token = os.getenv("GITHUB_TOKEN", None)
     conf.dry_run = True
     target_path: Path = SAVED_HTTPD_REQS / path
     target_path.parent.mkdir(parents=True, exist_ok=True)
     conf.github_requests_log_path = str(target_path)
     return conf
Ejemplo n.º 5
0
def global_service_config():
    """
    This config will be used instead of the one loaded from the local config file.

    You can still mock/overwrite the service config content in your tests
    but this one will be used by default.
    """
    service_config = ServiceConfig()
    service_config.services = {
        GithubService(token="token"),
        GitlabService(token="token"),
    }
    service_config.dry_run = False
    service_config.github_requests_log_path = "/path"
    service_config.server_name = "localhost"
    ServiceConfig.service_config = service_config