Beispiel #1
0
    def setUp(self):
        super(TestProxyPrivate, self).setUp()

        def method(self, expected_type, value):
            return value

        self.sot = mock.Mock()
        self.sot.method = method

        self.fake_proxy = proxy2.BaseProxy("session")
Beispiel #2
0
    def setUp(self):
        super(TestProxyCreate, self).setUp()

        self.session = mock.Mock()

        self.fake_result = "fake_result"
        self.res = mock.Mock(spec=CreateableResource)
        self.res.create = mock.Mock(return_value=self.fake_result)

        self.sot = proxy2.BaseProxy(self.session)
Beispiel #3
0
    def setUp(self):
        super(TestProxyList, self).setUp()

        self.session = mock.Mock()

        self.args = {"a": "A", "b": "B", "c": "C"}
        self.fake_response = [resource2.Resource()]

        self.sot = proxy2.BaseProxy(self.session)
        ListableResource.list = mock.Mock()
        ListableResource.list.return_value = self.fake_response
Beispiel #4
0
    def setUp(self):
        super(TestProxyDelete, self).setUp()

        self.session = mock.Mock()

        self.fake_id = 1
        self.res = mock.Mock(spec=DeleteableResource)
        self.res.id = self.fake_id
        self.res.delete = mock.Mock()

        self.sot = proxy2.BaseProxy(self.session)
        DeleteableResource.new = mock.Mock(return_value=self.res)
Beispiel #5
0
    def setUp(self):
        super(TestProxyHead, self).setUp()

        self.session = mock.Mock()

        self.fake_id = 1
        self.fake_name = "fake_name"
        self.fake_result = "fake_result"
        self.res = mock.Mock(spec=HeadableResource)
        self.res.id = self.fake_id
        self.res.head = mock.Mock(return_value=self.fake_result)

        self.sot = proxy2.BaseProxy(self.session)
        HeadableResource.new = mock.Mock(return_value=self.res)
Beispiel #6
0
    def setUp(self):
        super(TestProxyGet, self).setUp()

        self.session = mock.Mock()

        self.fake_id = 1
        self.fake_name = "fake_name"
        self.fake_result = "fake_result"
        self.res = mock.Mock(spec=RetrieveableResource)
        self.res.id = self.fake_id
        self.res.get = mock.Mock(return_value=self.fake_result)

        self.sot = proxy2.BaseProxy(self.session)
        RetrieveableResource.new = mock.Mock(return_value=self.res)
Beispiel #7
0
    def setUp(self):
        super(TestProxyUpdate, self).setUp()

        self.session = mock.Mock()

        self.fake_id = 1
        self.fake_result = "fake_result"

        self.res = mock.Mock(spec=UpdateableResource)
        self.res.update = mock.Mock(return_value=self.fake_result)

        self.sot = proxy2.BaseProxy(self.session)

        self.attrs = {"x": 1, "y": 2, "z": 3}

        UpdateableResource.new = mock.Mock(return_value=self.res)
Beispiel #8
0
    def setUp(self):
        super(TestProxyWaits, self).setUp()

        self.session = mock.Mock()
        self.sot = proxy2.BaseProxy(self.session)