-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix * add costs{GetRechargeAmount/GetConsumptionAmount/GetPropertiesUsedAmount} api
- Loading branch information
Showing
12 changed files
with
708 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package dao | ||
|
||
import ( | ||
"testing" | ||
"time" | ||
|
||
"github.com/labring/sealos/controllers/pkg/resources" | ||
"go.mongodb.org/mongo-driver/mongo" | ||
) | ||
|
||
func TestMongoDB_GetRechargeAmount(t *testing.T) { | ||
type fields struct { | ||
Client *mongo.Client | ||
AccountDBName string | ||
BillingConn string | ||
PropertiesConn string | ||
Properties *resources.PropertyTypeLS | ||
} | ||
type args struct { | ||
user string | ||
startTime time.Time | ||
endTime time.Time | ||
} | ||
tests := []struct { | ||
name string | ||
fields fields | ||
args args | ||
want int64 | ||
wantErr bool | ||
}{ | ||
// TODO: Add test cases. | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
m := &MongoDB{ | ||
Client: tt.fields.Client, | ||
AccountDBName: tt.fields.AccountDBName, | ||
BillingConn: tt.fields.BillingConn, | ||
PropertiesConn: tt.fields.PropertiesConn, | ||
Properties: tt.fields.Properties, | ||
} | ||
got, err := m.GetRechargeAmount(tt.args.user, tt.args.startTime, tt.args.endTime) | ||
if (err != nil) != tt.wantErr { | ||
t.Errorf("GetRechargeAmount() error = %v, wantErr %v", err, tt.wantErr) | ||
return | ||
} | ||
if got != tt.want { | ||
t.Errorf("GetRechargeAmount() got = %v, want %v", got, tt.want) | ||
} | ||
}) | ||
} | ||
} |
Oops, something went wrong.