def test_add_two_urls(self): walls.add_url(self.wall.unique_id, URL1) walls.add_url(self.wall.unique_id, URL2) w = walls.fetch(self.wall.unique_id) eq_(w.items.count(), 2) eq_(w.items[0].url, URL1) eq_(w.items[1].url, URL2)
def post(self, wall_id): try: wall_obj = json.loads(self.request.body) try: item = walls.add_url(wall_id, wall_obj['url']) self.respond_created(item_uri(item)) except ValueError: self.respond_bad_request('Url was malformed') except ValueError: self.respond_bad_request('Request did not contain valid JSON')
def test_bad_url(self): walls.add_url(self.wall, BAD_URL)
def setup(self): self.wall = walls.create(WALL_NAME) self.item = walls.add_url(self.wall.unique_id, 'http://www.testurl.com') self.url = '/res/collections/%s' % self.wall.unique_id