mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Merge branch 'master' of https://github.com/cgrates/cgrates
This commit is contained in:
@@ -27,7 +27,7 @@ import (
|
||||
|
||||
func TestHistoryRatinPlans(t *testing.T) {
|
||||
scribe := historyScribe.(*history.MockScribe)
|
||||
buf := scribe.BufMap[history.RATING_PROFILES_FN]
|
||||
buf := scribe.GetBuffer(history.RATING_PROFILES_FN)
|
||||
if !strings.Contains(buf.String(), `{"Id":"*out:vdf:0:minu","RatingPlanActivations":[{"ActivationTime":"2012-01-01T00:00:00Z","RatingPlanId":"EVENING","FallbackKeys":null}]}`) {
|
||||
t.Error("Error in destination history content:", buf.String())
|
||||
}
|
||||
@@ -35,7 +35,7 @@ func TestHistoryRatinPlans(t *testing.T) {
|
||||
|
||||
func TestHistoryDestinations(t *testing.T) {
|
||||
scribe := historyScribe.(*history.MockScribe)
|
||||
buf := scribe.BufMap[history.DESTINATIONS_FN]
|
||||
buf := scribe.GetBuffer(history.DESTINATIONS_FN)
|
||||
expected := `[{"Id":"ALL","Prefixes":["49","41","43"]},
|
||||
{"Id":"DST_UK_Mobile_BIG5","Prefixes":["447956"]},
|
||||
{"Id":"GERMANY","Prefixes":["49"]},
|
||||
|
||||
@@ -38,8 +38,10 @@ func NewMockScribe() (*MockScribe, error) {
|
||||
}
|
||||
|
||||
func (s *MockScribe) Record(rec Record, out *int) error {
|
||||
s.mu.Lock()
|
||||
fn := rec.Filename
|
||||
recordsMap[fn] = recordsMap[fn].SetOrAdd(&rec)
|
||||
s.mu.Unlock()
|
||||
s.save(fn)
|
||||
return nil
|
||||
}
|
||||
@@ -56,3 +58,9 @@ func (s *MockScribe) save(filename string) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *MockScribe) GetBuffer(fn string) *bytes.Buffer {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
return s.BufMap[fn]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user