[MM-22644] Dont allow message export for CSV, Acadiance, Global Relay if non-E20 customer via command line (#14584)

* dont allow message export for non E20 if export to csv acadiance or global relay

* add tests

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Hossein Ahmadian-Yazdi
2020-05-20 11:20:27 -04:00
коммит произвёл GitHub
родитель f62493145a
Коммит 173cfe9b88
2 изменённых файлов: 12 добавлений и 1 удалений

Просмотреть файл

@@ -145,6 +145,7 @@ func scheduleExportCmdF(command *cobra.Command, args []string) error {
func buildExportCmdF(format string) func(command *cobra.Command, args []string) error {
return func(command *cobra.Command, args []string) error {
a, err := InitDBCommandContextCobra(command)
license := a.License()
if err != nil {
return err
}
@@ -158,7 +159,7 @@ func buildExportCmdF(format string) func(command *cobra.Command, args []string)
return errors.New("exportFrom must be a positive integer")
}
if a.MessageExport() == nil {
if a.MessageExport() == nil || license == nil || !*license.Features.MessageExport {
return errors.New("message export feature not available")
}

Просмотреть файл

@@ -62,3 +62,13 @@ func TestMessageExportNegativeTimeoutSeconds(t *testing.T) {
// should fail fast because timeout seconds must be a positive int
require.Error(t, th.RunCommand(t, "--format", "actiance", "--exportFrom", "0", "--timeoutSeconds", "-1", "export", "schedule"))
}
func TestMessageExportFailsWithoutLicense(t *testing.T) {
th := Setup(t)
defer th.TearDown()
actual, _ := th.RunCommandWithOutput(t, "export", "csv", "export.csv", "--exportFrom", "0")
// should fail fast because timeout seconds must be a positive int
require.Contains(t, actual, "message export feature not available")
}