-
Notifications
You must be signed in to change notification settings - Fork 448
/
Copy pathExtensionBundleTests.cs
74 lines (68 loc) · 2.47 KB
/
ExtensionBundleTests.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
using Azure.Functions.Cli.Common;
using Azure.Functions.Cli.Tests.E2E;
using Azure.Functions.Cli.Tests.E2E.Helpers;
using Microsoft.Azure.WebJobs.Script;
using System;
using System.IO;
using System.Threading.Tasks;
using Xunit;
using Xunit.Abstractions;
namespace Azure.Functions.Cli.Tests.ExtensionsTests
{
public class ExtensionBundleTests : BaseE2ETest
{
public ExtensionBundleTests(ITestOutputHelper output) : base(output) { }
[Fact]
public Task BundleConfiguredByDefault_no_action()
{
return CliTester.Run(new RunConfiguration
{
Commands = new[] {
"init . --worker-runtime node",
"new --template SendGrid --name testfunc",
"extensions install"
},
OutputContains = new[]
{
"No action performed"
},
ExitInError = true,
CommandTimeout = TimeSpan.FromMinutes(300)
}, _output);
}
[Fact]
public Task BundleConfiguredByDefault_findsBundlePath()
{
string bundlePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), Constants.UserCoreToolsDirectory, "Functions", ScriptConstants.ExtensionBundleDirectory);
return CliTester.Run(new RunConfiguration
{
Commands = new[] {
"init . --worker-runtime node",
"GetExtensionBundlePath"
},
OutputContains = new[]
{
bundlePath
},
CommandTimeout = TimeSpan.FromMinutes(300)
}, _output);
}
[Fact]
public Task BundleNotConfiguredByDefault_showsErrorMessage()
{
string bundlePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), Constants.UserCoreToolsDirectory, "Functions", ScriptConstants.ExtensionBundleDirectory);
return CliTester.Run(new RunConfiguration
{
Commands = new[] {
"init . --worker-runtime node --no-bundle",
"GetExtensionBundlePath"
},
OutputContains = new[]
{
"Extension bundle not configured."
},
CommandTimeout = TimeSpan.FromMinutes(300)
}, _output);
}
}
}