2018-09-07 14:42:57 +00:00
|
|
|
/*
|
2019-03-20 19:32:48 +00:00
|
|
|
Copyright 2018 the Velero contributors.
|
2018-09-07 14:42:57 +00:00
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
package test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/stretchr/testify/mock"
|
2020-01-08 18:03:52 +00:00
|
|
|
corev1api "k8s.io/api/core/v1"
|
2018-09-07 14:42:57 +00:00
|
|
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
|
|
"k8s.io/apimachinery/pkg/types"
|
|
|
|
"k8s.io/apimachinery/pkg/watch"
|
|
|
|
corev1 "k8s.io/client-go/kubernetes/typed/core/v1"
|
|
|
|
)
|
|
|
|
|
|
|
|
type FakeNamespaceClient struct {
|
|
|
|
mock.Mock
|
|
|
|
}
|
|
|
|
|
|
|
|
var _ corev1.NamespaceInterface = &FakeNamespaceClient{}
|
|
|
|
|
2020-01-08 18:03:52 +00:00
|
|
|
func (c *FakeNamespaceClient) List(options metav1.ListOptions) (*corev1api.NamespaceList, error) {
|
2018-09-07 14:42:57 +00:00
|
|
|
args := c.Called(options)
|
2020-01-08 18:03:52 +00:00
|
|
|
return args.Get(0).(*corev1api.NamespaceList), args.Error(1)
|
2018-09-07 14:42:57 +00:00
|
|
|
}
|
|
|
|
|
2020-01-08 18:03:52 +00:00
|
|
|
func (c *FakeNamespaceClient) Create(obj *corev1api.Namespace) (*corev1api.Namespace, error) {
|
2018-09-07 14:42:57 +00:00
|
|
|
args := c.Called(obj)
|
2020-01-08 18:03:52 +00:00
|
|
|
return args.Get(0).(*corev1api.Namespace), args.Error(1)
|
2018-09-07 14:42:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (c *FakeNamespaceClient) Watch(options metav1.ListOptions) (watch.Interface, error) {
|
|
|
|
args := c.Called(options)
|
|
|
|
return args.Get(0).(watch.Interface), args.Error(1)
|
|
|
|
}
|
|
|
|
|
2020-01-08 18:03:52 +00:00
|
|
|
func (c *FakeNamespaceClient) Get(name string, opts metav1.GetOptions) (*corev1api.Namespace, error) {
|
2018-09-07 14:42:57 +00:00
|
|
|
args := c.Called(name, opts)
|
2020-01-08 18:03:52 +00:00
|
|
|
return args.Get(0).(*corev1api.Namespace), args.Error(1)
|
2018-09-07 14:42:57 +00:00
|
|
|
}
|
|
|
|
|
2020-01-08 18:03:52 +00:00
|
|
|
func (c *FakeNamespaceClient) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (*corev1api.Namespace, error) {
|
2018-09-07 14:42:57 +00:00
|
|
|
args := c.Called(name, pt, data, subresources)
|
2020-01-08 18:03:52 +00:00
|
|
|
return args.Get(0).(*corev1api.Namespace), args.Error(1)
|
2018-09-07 14:42:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (c *FakeNamespaceClient) Delete(name string, opts *metav1.DeleteOptions) error {
|
|
|
|
args := c.Called(name, opts)
|
|
|
|
return args.Error(1)
|
|
|
|
}
|
|
|
|
|
2020-01-08 18:03:52 +00:00
|
|
|
func (c *FakeNamespaceClient) Finalize(item *corev1api.Namespace) (*corev1api.Namespace, error) {
|
2018-09-07 14:42:57 +00:00
|
|
|
args := c.Called(item)
|
2020-01-08 18:03:52 +00:00
|
|
|
return args.Get(0).(*corev1api.Namespace), args.Error(1)
|
2018-09-07 14:42:57 +00:00
|
|
|
}
|
|
|
|
|
2020-01-08 18:03:52 +00:00
|
|
|
func (c *FakeNamespaceClient) Update(namespace *corev1api.Namespace) (*corev1api.Namespace, error) {
|
2018-09-07 14:42:57 +00:00
|
|
|
args := c.Called(namespace)
|
2020-01-08 18:03:52 +00:00
|
|
|
return args.Get(0).(*corev1api.Namespace), args.Error(1)
|
2018-09-07 14:42:57 +00:00
|
|
|
}
|
|
|
|
|
2020-01-08 18:03:52 +00:00
|
|
|
func (c *FakeNamespaceClient) UpdateStatus(namespace *corev1api.Namespace) (*corev1api.Namespace, error) {
|
2018-09-07 14:42:57 +00:00
|
|
|
args := c.Called(namespace)
|
2020-01-08 18:03:52 +00:00
|
|
|
return args.Get(0).(*corev1api.Namespace), args.Error(1)
|
2018-09-07 14:42:57 +00:00
|
|
|
}
|