Unverified Commit 67499b50 authored by Sigurd Meldgaard's avatar Sigurd Meldgaard Committed by GitHub

Add new pub command 'Token' (#91014)

parent 95baca94
...@@ -38,6 +38,7 @@ class PackagesCommand extends FlutterCommand { ...@@ -38,6 +38,7 @@ class PackagesCommand extends FlutterCommand {
addSubcommand(PackagesForwardCommand('logout', 'Log out of pub.dev.')); addSubcommand(PackagesForwardCommand('logout', 'Log out of pub.dev.'));
addSubcommand(PackagesForwardCommand('global', 'Work with Pub global packages')); addSubcommand(PackagesForwardCommand('global', 'Work with Pub global packages'));
addSubcommand(PackagesForwardCommand('outdated', 'Analyze dependencies to find which ones can be upgraded', requiresPubspec: true)); addSubcommand(PackagesForwardCommand('outdated', 'Analyze dependencies to find which ones can be upgraded', requiresPubspec: true));
addSubcommand(PackagesForwardCommand('token', 'Manage authentication tokens for hosted pub repositories.'));
addSubcommand(PackagesPassthroughCommand()); addSubcommand(PackagesPassthroughCommand());
} }
......
...@@ -525,6 +525,34 @@ void main() { ...@@ -525,6 +525,34 @@ void main() {
), ),
}); });
testUsingContext('token pass arguments through to pub', () async {
Cache.flutterRoot = '';
globals.fs.file('pubspec.yaml').createSync();
final IOSink stdin = IOSink(StreamController<List<int>>().sink);
processManager.addCommand(
FakeCommand(command: const <String>[
'/bin/cache/dart-sdk/bin/dart', '__deprecated_pub', 'token', 'list'],
stdin: stdin,
),
);
await createTestCommandRunner(PackagesCommand()).run(<String>['packages', '--verbose', 'pub', 'token', 'list']);
expect(processManager, hasNoRemainingExpectations);
}, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem.test(),
Platform: () => FakePlatform(environment: <String, String>{}),
ProcessManager: () => processManager,
Stdio: () => mockStdio,
Pub: () => Pub(
fileSystem: globals.fs,
logger: globals.logger,
processManager: globals.processManager,
usage: globals.flutterUsage,
botDetector: globals.botDetector,
platform: globals.platform,
),
});
testUsingContext('upgrade does not check for pubspec.yaml if -h/--help is passed', () async { testUsingContext('upgrade does not check for pubspec.yaml if -h/--help is passed', () async {
Cache.flutterRoot = ''; Cache.flutterRoot = '';
processManager.addCommand( processManager.addCommand(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment