コード例 #1
0
    def add_member(self, image_id, member_id, requestslib_kwargs=None):
        """@summary: Add a member to an image"""

        url = '{0}/images/{1}/members'.format(self.base_url, image_id)
        member = Member(member_id=member_id)
        return self.request('POST', url, request_entity=member,
                            response_entity_type=Member,
                            requestslib_kwargs=requestslib_kwargs)
コード例 #2
0
ファイル: client.py プロジェクト: kksure/cloudcafe
    def update_member(self, image_id, member_id, status):
        url = '{base_url}/images/{image_id}/members/{member_id}'.format(
            base_url=self.base_url, image_id=image_id, member_id=member_id)

        member = Member(image_id=image_id, member_id=member_id, status=status)

        return self.request('PUT',
                            url,
                            request_entity=member,
                            response_entity_type=Member)
コード例 #3
0
ファイル: client.py プロジェクト: kksure/cloudcafe
    def add_member(self, image_id, member_id):
        url = '{base_url}/images/{image_id}/members'.format(
            base_url=self.base_url, image_id=image_id)

        member = Member(image_id=image_id, member_id=member_id)

        return self.request('POST',
                            url,
                            request_entity=member,
                            response_entity_type=Member)
コード例 #4
0
    def update_member(self, image_id, member_id, status,
                      requestslib_kwargs=None):
        """@summary: Update a member for an image"""

        url = '{0}/images/{1}/members/{2}'.format(self.base_url, image_id,
                                                  member_id)
        member = Member(status=status)
        return self.request('PUT', url, request_entity=member,
                            response_entity_type=Member,
                            requestslib_kwargs=requestslib_kwargs)
コード例 #5
0
ファイル: member_test.py プロジェクト: kksure/cloudcafe
    def setup_class(cls):
        cls.raw_member_str = ('''{
            "status": "accepted",
            "created_at": "2013-09-17T12:51:03Z",
            "updated_at": "2013-09-17T13:14:28Z",
            "image_id": "af61731b-7181-4831-821f-b868df122f5a",
            "member_id": "someguy",
            "schema": "/v2/schemas/member"
        }''')

        cls.member_obj = \
            Member(member_id='someguy', status='accepted',
                   created_at=datetime.strptime('2013-09-17T12:51:03Z',
                                                '%Y-%m-%dT%H:%M:%SZ'),
                   updated_at=datetime.strptime('2013-09-17T13:14:28Z',
                                                '%Y-%m-%dT%H:%M:%SZ'),
                   image_id='af61731b-7181-4831-821f-b868df122f5a')
コード例 #6
0
    def setup_class(cls):
        cls.raw_members_str = ('''{
        "members": [
        {
            "status": "accepted",
            "created_at": "2013-09-17T12:51:03Z",
            "updated_at": "2013-09-17T13:14:28Z",
            "image_id": "af61731b-7181-4831-821f-b868df122f5a",
            "member_id": "someguy",
            "schema": "/v2/schemas/member"
        }],
        "schema": "/v2/schemas/members"
        }''')

        cls.members_obj = [
            (Member(member_id='someguy',
                    status='accepted',
                    created_at='2013-09-17T12:51:03Z',
                    updated_at='2013-09-17T13:14:28Z',
                    image_id='af61731b-7181-4831-821f-b868df122f5a',
                    schema="/v2/schemas/member"))
        ]
コード例 #7
0
ファイル: member_test.py プロジェクト: jc7998/cloudcafe
 def test_json_to_obj(self):
     deserialized_obj = Member._json_to_obj(self.raw_member_str)
     assert self.member_obj == deserialized_obj
コード例 #8
0
ファイル: member_test.py プロジェクト: kksure/cloudcafe
    def test_json_to_obj(self):
        deserialized_obj = Member._json_to_obj(self.raw_member_str)

        assert self.member_obj == deserialized_obj