• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

UiPath / uipathcli / 22833181054

09 Mar 2026 12:15AM UTC coverage: 90.831% (-0.08%) from 90.914%
22833181054

Pull #212

github

Chibi Vikram
Add direct Execute tests for defensive parameter validation

Test parameter type assertion failure and empty value checks by calling
Execute directly, bypassing CLI framework validation. Covers
getStringParameter false branch and source/solutionId empty checks in
unpack, push, pull, and publish commands.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Pull Request #212: Add studio solution commands, skill, and agents.md

606 of 674 new or added lines in 16 files covered. (89.91%)

3 existing lines in 1 file now uncovered.

7380 of 8125 relevant lines covered (90.83%)

1.02 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

96.36
/plugin/studio/solution/push/solution_push_command.go
1
// Package push implements the command plugin for pushing a .uis solution
2
// file to UiPath Studio Web.
3
package push
4

5
import (
6
        "bytes"
7
        "encoding/json"
8
        "errors"
9
        "fmt"
10
        "net/http"
11
        "os"
12
        "path/filepath"
13

14
        "github.com/UiPath/uipathcli/log"
15
        "github.com/UiPath/uipathcli/output"
16
        "github.com/UiPath/uipathcli/plugin"
17
        "github.com/UiPath/uipathcli/utils/api"
18
        "github.com/UiPath/uipathcli/utils/stream"
19
        "github.com/UiPath/uipathcli/utils/visualization"
20
)
21

22
// The SolutionPushCommand pushes a .uis file to Studio Web.
23
type SolutionPushCommand struct{}
24

25
func (c SolutionPushCommand) Command() plugin.Command {
1✔
26
        return *plugin.NewCommand("studio").
1✔
27
                WithCategory("solution", "UiPath Solution management", "Pack, unpack, push and pull UiPath Maestro solutions.").
1✔
28
                WithOperation("push", "Push Solution", "Pushes a .uis solution file to UiPath Studio Web").
1✔
29
                WithParameter(plugin.NewParameter("source", plugin.ParameterTypeString, "Path to .uis file").
1✔
30
                        WithRequired(true)).
1✔
31
                WithParameter(plugin.NewParameter("solution-id", plugin.ParameterTypeString, "Solution ID to update (optional, for updating existing solutions)").
1✔
32
                        WithDefaultValue(""))
1✔
33
}
1✔
34

35
func (c SolutionPushCommand) Execute(ctx plugin.ExecutionContext, writer output.OutputWriter, logger log.Logger) error {
1✔
36
        if ctx.Organization == "" {
2✔
37
                return errors.New("Organization is not set")
1✔
38
        }
1✔
39
        source := c.getStringParameter("source", "", ctx.Parameters)
1✔
40
        if source == "" {
2✔
41
                return errors.New("Source .uis file is required")
1✔
42
        }
1✔
43
        source, _ = filepath.Abs(source)
1✔
44
        solutionId := c.getStringParameter("solution-id", "", ctx.Parameters)
1✔
45

1✔
46
        if _, err := os.Stat(source); err != nil {
2✔
47
                return fmt.Errorf("File not found: %s", source)
1✔
48
        }
1✔
49

50
        params := newSolutionPushParams(source, solutionId, ctx.BaseUri, ctx.Organization, ctx.Auth, ctx.Debug, ctx.Settings)
1✔
51
        result, err := c.push(*params, logger)
1✔
52
        if err != nil {
2✔
53
                return err
1✔
54
        }
1✔
55

56
        jsonData, err := json.Marshal(result)
1✔
57
        if err != nil {
1✔
NEW
58
                return fmt.Errorf("Push command failed: %w", err)
×
NEW
59
        }
×
60
        return writer.WriteResponse(*output.NewResponseInfo(http.StatusOK, "200 OK", "HTTP/1.1", map[string][]string{}, bytes.NewReader(jsonData)))
1✔
61
}
62

63
func (c SolutionPushCommand) push(params solutionPushParams, logger log.Logger) (*solutionPushResult, error) {
1✔
64
        file := stream.NewFileStream(params.Source)
1✔
65
        uploadBar := visualization.NewProgressBar(logger)
1✔
66
        defer uploadBar.Remove()
1✔
67

1✔
68
        client := api.NewStudioClient(params.BaseUri, params.Organization, params.Auth.Token, params.Debug, params.Settings, logger)
1✔
69
        response, err := client.PushSolution(file, params.SolutionId, uploadBar)
1✔
70
        if err != nil {
2✔
71
                return nil, err
1✔
72
        }
1✔
73

74
        return newSucceededSolutionPushResult(params.Source, response.SolutionId), nil
1✔
75
}
76

77
func (c SolutionPushCommand) getStringParameter(name string, defaultValue string, parameters []plugin.ExecutionParameter) string {
1✔
78
        result := defaultValue
1✔
79
        for _, p := range parameters {
2✔
80
                if p.Name == name {
2✔
81
                        if data, ok := p.Value.(string); ok {
2✔
82
                                result = data
1✔
83
                                break
1✔
84
                        }
85
                }
86
        }
87
        return result
1✔
88
}
89

90
func NewSolutionPushCommand() *SolutionPushCommand {
1✔
91
        return &SolutionPushCommand{}
1✔
92
}
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc