def test_post(self): """ Posting a new event to a queue should tack said event onto the end of said queue. """ cfp = cloudfeeds.CloudFeedsProduct(title='title', href='href') cfp.post("TROLOLOLOLOL!!!") cfp.post("This is a totally fake event-like thing.") self.assertEquals( cfp.events, ["TROLOLOLOLOL!!!", "This is a totally fake event-like thing."])
def test_json_description(self): """ When listing product endpoints, we expect our JSON to look a certain way. The easiest way to do that is to acquire the corresponding dict, then pass it through json.dump with your preferred formatting settings. """ cfp = cloudfeeds.CloudFeedsProduct(title='title', href='href') d = cloudfeeds.render_product_dict(cfp) productDescription = MatchesDict({ "title": Equals("title"), "collection": MatchesDict({ "href": Equals("href"), "title": Equals("title"), }), }) self.assertEquals(productDescription.match(d), None)
def test_creation(self): """ A new product queue should be empty. """ cfp = cloudfeeds.CloudFeedsProduct(title='title', href='href') self.assertEquals(len(cfp.events), 0)