func TestByContainerProcess(t *testing.T) {
	for n, _ := range cbMap {
		delete(cbMap, n)
	}

	cases := []struct {
		id       string
		url      string
		name     string
		expected bool
	}{
		//We need to add a real scan image to make the test work, but that will be integrate test
		{"1", "snapshot", "bycontainer/ospaf/notexist", false},
		{"2", "snapshot", "bycontainer/busybox", true},
	}
	var bycontainer snapshot.UpdateServiceSnapshotByContainer
	_, path, _, _ := runtime.Caller(0)
	dir := filepath.Join(filepath.Dir(path), "testdata")

	for _, c := range cases {
		info := snapshot.SnapshotInputInfo{CallbackID: c.id, DataURL: filepath.Join(dir, c.url), Name: c.name}
		a, _ := bycontainer.New(info)
		err := a.Process()
		if err == utils.ErrorsNoDockerClient {
			fmt.Println("No Docker client detected")
			return
		}
		assert.Nil(t, err, "Fail to process")
	}
}
func TestByContainerSupported(t *testing.T) {
	cases := []struct {
		proto    string
		expected bool
	}{
		{"appv1", true},
		{"dockerv1", true},
		{"invalid", false},
	}

	var bycontainer snapshot.UpdateServiceSnapshotByContainer
	for _, c := range cases {
		assert.Equal(t, c.expected, bycontainer.Supported(c.proto), "Fail to get supported status")
	}
}
func TestByContainerNew(t *testing.T) {
	cases := []struct {
		id       string
		url      string
		name     string
		expected bool
	}{
		{"id", "url", "bycontainer/busybox", true},
		{"", "url", "bycontainer/busybox", false},
		{"id", "", "bycontainer/busybox", false},
		{"id", "url", "", false},
	}

	var bc snapshot.UpdateServiceSnapshotByContainer
	for _, c := range cases {
		info := snapshot.SnapshotInputInfo{CallbackID: c.id, DataURL: c.url, Name: c.name}
		_, err := bc.New(info)
		assert.Equal(t, c.expected, err == nil, "Fail to create new bycontainer snapshot")
	}
}