[#137] metabase: Add unit test for a nonexistent attribute
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
7704811654
commit
d9a5007c72
1 changed files with 21 additions and 0 deletions
|
@ -239,3 +239,24 @@ func releaseDB(db *DB) {
|
|||
db.Close()
|
||||
os.Remove(db.Path())
|
||||
}
|
||||
|
||||
func TestSelectNonExistentAttributes(t *testing.T) {
|
||||
db := newDB(t)
|
||||
|
||||
defer releaseDB(db)
|
||||
|
||||
obj := object.NewRaw()
|
||||
obj.SetID(testOID())
|
||||
obj.SetContainerID(testCID())
|
||||
|
||||
require.NoError(t, db.Put(obj.Object()))
|
||||
|
||||
fs := objectSDK.SearchFilters{}
|
||||
|
||||
// add filter by non-existent attribute
|
||||
fs.AddFilter("key", "value", objectSDK.MatchStringEqual)
|
||||
|
||||
res, err := db.Select(fs)
|
||||
require.NoError(t, err)
|
||||
require.Empty(t, res)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue