...

Source file src/github.com/theupdateframework/go-tuf/client/local_store_test.go

Documentation: github.com/theupdateframework/go-tuf/client

     1  package client
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/assert"
     7  )
     8  
     9  func TestDeleteMeta(t *testing.T) {
    10  	l := MemoryLocalStore()
    11  	defer func() {
    12  		assert.Equal(t, nil, l.Close())
    13  	}()
    14  	assert.Equal(t, l.SetMeta("root.json", []byte(`
    15    {
    16  	  "signed": {},
    17  	  "signatures": {},
    18    }
    19    `)), nil)
    20  	m, err := l.GetMeta()
    21  	assert.Equal(t, err, nil)
    22  	if _, ok := m["root.json"]; !ok {
    23  		t.Fatalf("Expected metadata not found!")
    24  	}
    25  	l.DeleteMeta("root.json")
    26  	if _, ok := m["root.json"]; ok {
    27  		t.Fatalf("Metadata is not deleted!")
    28  	}
    29  }
    30  

View as plain text