bug fixses

This commit is contained in:
Radu Ioan Fericean
2012-10-01 14:42:27 +03:00
parent 1fc35c25a1
commit 5ef5eb84d0
4 changed files with 8 additions and 13 deletions

View File

@@ -36,7 +36,7 @@ type CmdGetBalance struct {
// name should be exec's name
func (self *CmdGetBalance) Usage(name string) string {
return fmt.Sprintf("\n\tUsage: %s [cfg_opts...{-h}] get_balance <tenant> <user> [<balanceid> [<direction>]]")
return fmt.Sprintf("\n\tUsage: cgr-console [cfg_opts...{-h}] get_balance <tenant> <user> [<balanceid> [<direction>]]")
}
// set param defaults

View File

@@ -1,8 +1,7 @@
package console
import (
"fmt"
"path/filepath"
"errors"
)
var (
@@ -22,11 +21,11 @@ type Commander interface {
// Process args and return right command Value or error
func GetCommandValue(args []string) (Commander, error) {
if len(args) < 2 {
return nil, fmt.Errorf("\n\tUsage: %s [cfg_opts...{-h}] <command>\n", filepath.Base(args[0]))
return nil, errors.New("\n\tUsage: cgr-console [cfg_opts...{-h}] <command>\n")
}
cmdVal, exists := commands[args[1]]
if !exists {
return nil, fmt.Errorf("\n\tUsage: %s [cfg_opts...{-h}] <status|get_balance>\n", filepath.Base(args[0]))
return nil, errors.New("\n\tUsage: cgr-console [cfg_opts...{-h}] <status|get_balance>\n")
}
if err := cmdVal.FromArgs(args); err != nil {
return nil, err

View File

@@ -22,10 +22,4 @@ import (
_ "github.com/cgrates/cgrates/cmd/cgr-console"
_ "github.com/cgrates/cgrates/cmd/cgr-loader"
_ "github.com/cgrates/cgrates/cmd/cgr-rater"
"github.com/cgrates/cgrates/timespans"
)
func main(){
cd := timespans.CallDesc{}
}

View File

@@ -392,14 +392,16 @@ func TestActionTimingLogFunction(t *testing.T) {
}
}
func TestActionTimingPriotityList(t *testing.T) {
func TestActionTimingPriotityListSortByWeight(t *testing.T) {
at1 := &ActionTiming{Timing: &Interval{
Years: Years{2100},
Months: Months{time.January, time.February, time.March, time.April, time.May, time.June, time.July, time.August, time.September, time.October, time.November, time.December},
MonthDays: MonthDays{1},
StartTime: "00:00:00",
Weight: 20,
}}
at2 := &ActionTiming{Timing: &Interval{
Years: Years{2100},
Months: Months{time.January, time.February, time.March, time.April, time.May, time.June, time.July, time.August, time.September, time.October, time.November, time.December},
MonthDays: MonthDays{2},
StartTime: "00:00:00",
@@ -409,7 +411,7 @@ func TestActionTimingPriotityList(t *testing.T) {
atpl = append(atpl, at2, at1)
atpl.Sort()
if atpl[0] != at1 || atpl[1] != at2 {
t.Error("Timing list not sorted correctly: ", atpl)
t.Error("Timing list not sorted correctly: ", at1, at2, atpl)
}
}