Skip to content

Commit

Permalink
Reomve wercker.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
LyricTian committed May 16, 2016
1 parent 34af050 commit f504489
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 60 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Golang Dirty Filter

[![GoDoc](https://godoc.org/github.com/antlinker/go-dirtyfilter?status.svg)](https://godoc.org/github.com/antlinker/go-dirtyfilter)
[![wercker status](https://app.wercker.com/status/02cb69dcbba94ee4274f1c0c06ce68f9/s "wercker status")](https://app.wercker.com/project/bykey/02cb69dcbba94ee4274f1c0c06ce68f9)

> 基于DFA算法;
> 支持动态修改敏感词,同时支持特殊字符的筛选;
Expand Down
119 changes: 60 additions & 59 deletions store/mongo_test.go
Original file line number Diff line number Diff line change
@@ -1,62 +1,63 @@
package store_test

// import (
// "github.com/antlinker/go-dirtyfilter/store"
// . "github.com/onsi/ginkgo"
// . "github.com/onsi/gomega"
// )
import (
"github.com/antlinker/go-dirtyfilter/store"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)

// var _ = Describe("敏感词MongoDB存储测试", func() {
// var (
// mgoStore *store.MongoStore
// )
// BeforeEach(func() {
// s, err := store.NewMongoStore(store.MongoConfig{
// URL: "mongodb://localhost:27017/sample?maxPoolSize=128",
// })
// if err != nil {
// Fail(err.Error())
// return
// }
// mgoStore = s
// err = s.Write("共产党")
// if err != nil {
// Fail(err.Error())
// return
// }
// })
// It("Read Test", func() {
// for v := range mgoStore.Read() {
// Expect(v).To(Equal("共产党"))
// }
// })
// It("ReadAll Test", func() {
// result, err := mgoStore.ReadAll()
// if err != nil {
// Fail(err.Error())
// return
// }
// Expect(result).To(Equal([]string{"共产党"}))
// })
// It("Version Test", func() {
// Expect(mgoStore.Version()).To(Equal(uint64(1)))
// err := mgoStore.Write("党")
// if err != nil {
// Fail(err.Error())
// return
// }
// Expect(mgoStore.Version()).To(Equal(uint64(2)))
// err = mgoStore.Remove("党")
// if err != nil {
// Fail(err.Error())
// return
// }
// })
// AfterEach(func() {
// err := mgoStore.Remove("共产党")
// if err != nil {
// Fail(err.Error())
// return
// }
// })
// })
var _ = Describe("敏感词MongoDB存储测试", func() {
var (
mgoStore *store.MongoStore
)
BeforeEach(func() {
s, err := store.NewMongoStore(store.MongoConfig{
URL: "mongodb://admin:123456@192.168.33.70:27017",
DB: "sample",
})
if err != nil {
Fail(err.Error())
return
}
mgoStore = s
err = s.Write("共产党")
if err != nil {
Fail(err.Error())
return
}
})
It("Read Test", func() {
for v := range mgoStore.Read() {
Expect(v).To(Equal("共产党"))
}
})
It("ReadAll Test", func() {
result, err := mgoStore.ReadAll()
if err != nil {
Fail(err.Error())
return
}
Expect(result).To(Equal([]string{"共产党"}))
})
It("Version Test", func() {
Expect(mgoStore.Version()).To(Equal(uint64(1)))
err := mgoStore.Write("党")
if err != nil {
Fail(err.Error())
return
}
Expect(mgoStore.Version()).To(Equal(uint64(2)))
err = mgoStore.Remove("党")
if err != nil {
Fail(err.Error())
return
}
})
AfterEach(func() {
err := mgoStore.Remove("共产党")
if err != nil {
Fail(err.Error())
return
}
})
})

0 comments on commit f504489

Please sign in to comment.