Beispiel #1
0
 def setup_class(cls):
     cls.payload = ConsumerPayload() \
         .add_name(cls.name) \
         .add_description(cls.description) \
         .add_url(cls.consumer_url) \
         .add_callback_url(cls.callback_url) \
         .add_scopes(cls.scopes) \
         .validate() \
         .build()
Beispiel #2
0
class ConsumerPayloadFixture(ConsumerFixture):
    builder = ConsumerPayload()

    # GIVEN: a class under test
    class_under_test = 'ConsumerPayload'

    # GIVEN: An example object created from example data
    @classmethod
    def example_object(cls):
        return ConsumerPayload(json.loads(cls.resource_data()))
Beispiel #3
0
 def setup_class(cls):
     cls.payload = ConsumerPayload() \
         .add_name(cls.name) \
         .add_description(cls.description) \
         .add_url(cls.consumer_url) \
         .add_key(cls.consumer_key) \
         .add_secret(cls.shared_secret) \
         .add_callback_url(cls.callback_url) \
         .add_consumer_id(cls.consumer_id)
     cls.expected = json.loads(cls.resource_data('ConsumerPayload.full'))
Beispiel #4
0
 def test_response_is_a_consumer(self):
     httpretty.register_uri(httpretty.PUT,
                            self.resource_url(),
                            content_type='application/json',
                            body=self.resource_data(),
                            status=200)
     payload = ConsumerPayload() \
         .add_name(self.name) \
         .add_callback_url(self.callback_url)
     response = self.example_object().update(payload=payload)
     assert 'application/x-www-form-urlencoded' == \
         httpretty.last_request().headers.get('Content-Type')
     assert self.callback_url == \
         httpretty.last_request().parsed_body['callback_url'][0]
     assert isinstance(response, Consumer)
Beispiel #5
0
 def test_response_is_a_consumer(self):
     httpretty.register_uri(httpretty.POST,
                            self.url,
                            content_type='application/json',
                            body=self.resource_data(),
                            status=200)
     payload = ConsumerPayload() \
         .add_name(self.name) \
         .add_description(self.description) \
         .add_url(self.consumer_url) \
         .add_callback_url(self.callback_url) \
         .add_scopes(self.scopes)
     response = Consumer.create(payload, client=self.test_client)
     assert 'application/x-www-form-urlencoded' == \
         httpretty.last_request().headers.get('Content-Type')
     assert 2 == \
         len(httpretty.last_request().parsed_body.get('scopes'))
     assert isinstance(response, Consumer)
Beispiel #6
0
 def example_object(cls):
     return ConsumerPayload(json.loads(cls.resource_data()))
Beispiel #7
0
 def setup_class(cls):
     cls.payload = ConsumerPayload() \
         .add_name(cls.name)
     cls.expected = json.loads(cls.resource_data('ConsumerPayload.minimal'))
Beispiel #8
0
 def setup_class(cls):
     cls.builder = ConsumerPayload() \
         .add_name(cls.name)
Beispiel #9
0
 def setup_class(cls):
     cls.payload = ConsumerPayload() \
         .add_name(cls.name)