|
1 | 1 | import { join } from 'upath';
|
2 | 2 | import { mockExecAll } from '../../../../../test/exec-util';
|
3 |
| -import { fs, mockedFunction } from '../../../../../test/util'; |
| 3 | +import { fs, hostRules, mockedFunction } from '../../../../../test/util'; |
4 | 4 | import { GlobalConfig } from '../../../../config/global';
|
5 | 5 | import type { RepoGlobalConfig } from '../../../../config/types';
|
6 | 6 | import { getPkgReleases as _getPkgReleases } from '../../../datasource';
|
@@ -268,6 +268,69 @@ describe('modules/manager/pep621/processors/uv', () => {
|
268 | 268 | ]);
|
269 | 269 | });
|
270 | 270 |
|
| 271 | + it('performs update on private package registry', async () => { |
| 272 | + const execSnapshots = mockExecAll(); |
| 273 | + GlobalConfig.set(adminConfig); |
| 274 | + hostRules.add({ |
| 275 | + matchHost: 'https://example.com', |
| 276 | + username: 'user', |
| 277 | + password: 'pass', |
| 278 | + }); |
| 279 | + fs.getSiblingFileName.mockReturnValueOnce('uv.lock'); |
| 280 | + fs.readLocalFile.mockResolvedValueOnce('test content'); |
| 281 | + fs.readLocalFile.mockResolvedValueOnce('changed test content'); |
| 282 | + // python |
| 283 | + getPkgReleases.mockResolvedValueOnce({ |
| 284 | + releases: [{ version: '3.11.1' }, { version: '3.11.2' }], |
| 285 | + }); |
| 286 | + // uv |
| 287 | + getPkgReleases.mockResolvedValueOnce({ |
| 288 | + releases: [{ version: '0.2.35' }, { version: '0.2.28' }], |
| 289 | + }); |
| 290 | + |
| 291 | + const updatedDeps = [ |
| 292 | + { |
| 293 | + packageName: 'dep1', |
| 294 | + depType: depTypes.dependencies, |
| 295 | + registryUrls: ['https://foobar.com'], |
| 296 | + }, |
| 297 | + { |
| 298 | + packageName: 'dep2', |
| 299 | + depType: depTypes.dependencies, |
| 300 | + registryUrls: ['https://example.com'], |
| 301 | + }, |
| 302 | + ]; |
| 303 | + const result = await processor.updateArtifacts( |
| 304 | + { |
| 305 | + packageFileName: 'pyproject.toml', |
| 306 | + newPackageFileContent: '', |
| 307 | + config: {}, |
| 308 | + updatedDeps, |
| 309 | + }, |
| 310 | + {}, |
| 311 | + ); |
| 312 | + expect(result).toEqual([ |
| 313 | + { |
| 314 | + file: { |
| 315 | + contents: 'changed test content', |
| 316 | + path: 'uv.lock', |
| 317 | + type: 'addition', |
| 318 | + }, |
| 319 | + }, |
| 320 | + ]); |
| 321 | + expect(execSnapshots).toMatchObject([ |
| 322 | + { |
| 323 | + cmd: 'uv lock --upgrade-package dep1 --upgrade-package dep2', |
| 324 | + options: { |
| 325 | + env: { |
| 326 | + UV_EXTRA_INDEX_URL: |
| 327 | + 'https://foobar.com/ https://user:[email protected]/', |
| 328 | + }, |
| 329 | + }, |
| 330 | + }, |
| 331 | + ]); |
| 332 | + }); |
| 333 | + |
271 | 334 | it('return update on lockfileMaintenance', async () => {
|
272 | 335 | const execSnapshots = mockExecAll();
|
273 | 336 | GlobalConfig.set(adminConfig);
|
|
0 commit comments