refactor(shorebird_cli): eliminate dependency on chmod (#3259)
This commit is contained in:
@@ -433,26 +433,20 @@ void main() {
|
||||
);
|
||||
});
|
||||
|
||||
test(
|
||||
'returns null when error occurs reading pubspec.yaml',
|
||||
() {
|
||||
final tempDir = Directory.systemTemp.createTempSync();
|
||||
final file = File(p.join(tempDir.path, 'pubspec.yaml'))
|
||||
..writeAsStringSync('name: test');
|
||||
// Make the file unreadable.
|
||||
Process.runSync('chmod', ['000', file.path]);
|
||||
expect(
|
||||
IOOverrides.runZoned(
|
||||
() => runWithOverrides(() => shorebirdEnv.getPubspecYaml()),
|
||||
getCurrentDirectory: () => tempDir,
|
||||
),
|
||||
isNull,
|
||||
);
|
||||
},
|
||||
onPlatform: {
|
||||
'windows': const Skip('chmod is not available on Windows'),
|
||||
},
|
||||
);
|
||||
test('returns null when error occurs reading pubspec.yaml', () {
|
||||
final tempDir = Directory.systemTemp.createTempSync();
|
||||
// This is not valid utf8 so readAsString will throw.
|
||||
File(
|
||||
p.join(tempDir.path, 'pubspec.yaml'),
|
||||
).writeAsBytesSync([999999999999]);
|
||||
expect(
|
||||
IOOverrides.runZoned(
|
||||
() => runWithOverrides(() => shorebirdEnv.getPubspecYaml()),
|
||||
getCurrentDirectory: () => tempDir,
|
||||
),
|
||||
isNull,
|
||||
);
|
||||
});
|
||||
|
||||
test('returns value when pubspec.yaml exists', () {
|
||||
final tempDir = Directory.systemTemp.createTempSync();
|
||||
@@ -747,29 +741,21 @@ base_url: https://example.com''');
|
||||
expect(runWithOverrides(() => shorebirdEnv.hostedUri), isNull);
|
||||
});
|
||||
|
||||
test(
|
||||
'returns null when unable to read shorebird.yaml',
|
||||
() {
|
||||
final directory = Directory.systemTemp.createTempSync();
|
||||
final file = File(p.join(directory.path, 'shorebird.yaml'))
|
||||
..writeAsStringSync('''
|
||||
app_id: test-id
|
||||
base_url: https://example.com''');
|
||||
// Make the file unreadable.
|
||||
Process.runSync('chmod', ['000', file.path]);
|
||||
test('returns null when unable to read shorebird.yaml', () {
|
||||
final directory = Directory.systemTemp.createTempSync();
|
||||
// This is not valid utf8 so readAsString will throw.
|
||||
File(
|
||||
p.join(directory.path, 'shorebird.yaml'),
|
||||
).writeAsBytesSync([999999999999]);
|
||||
|
||||
expect(
|
||||
IOOverrides.runZoned(
|
||||
() => runWithOverrides(() => shorebirdEnv.hostedUri),
|
||||
getCurrentDirectory: () => directory,
|
||||
),
|
||||
isNull,
|
||||
);
|
||||
},
|
||||
onPlatform: {
|
||||
'windows': const Skip('chmod is not available on Windows'),
|
||||
},
|
||||
);
|
||||
expect(
|
||||
IOOverrides.runZoned(
|
||||
() => runWithOverrides(() => shorebirdEnv.hostedUri),
|
||||
getCurrentDirectory: () => directory,
|
||||
),
|
||||
isNull,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
group('canAcceptUserInput', () {
|
||||
|
||||
Reference in New Issue
Block a user