def resource_url(cls): return expand( Consumer(client=cls.test_client).templates['self'], { 'bitbucket_url': cls.test_client.get_bitbucket_url(), 'username': cls.test_client.get_username(), 'consumer_id': cls.consumer_id })
def test_response_is_a_consumer_generator(self): httpretty.register_uri(httpretty.GET, self.resource_list_url(), content_type='application/json', body=self.resource_list_data(), status=200) response = Consumer.find_consumers(client=self.test_client) assert isinstance(next(response), Consumer)
def test_response_is_a_consumer(self): httpretty.register_uri(httpretty.GET, self.resource_url(), content_type='application/json', body=self.resource_data(), status=200) response = \ Consumer.find_consumer_by_id( consumer_id=self.consumer_id, client=self.test_client) assert isinstance(response, Consumer)
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)
def setup_class(cls): cls._self = Consumer.get_link_template('self') cls._owner = Consumer.get_link_template('owner') cls._consumers = Consumer.get_link_template('consumers')
def test_passes_the_type_check_for_consumer(self): assert Consumer.is_type(self.data)
def setup_class(cls): cls.url = expand( Consumer(client=cls.test_client).templates['create'], { 'bitbucket_url': cls.test_client.get_bitbucket_url(), 'username': cls.test_client.get_username(), })
def example_object(cls): return Consumer(json.loads(cls.resource_data()), client=cls.test_client)