class TestPayload(unittest.TestCase): def setUp(self): self.payload = Payload() self.payload.add({'red': 'special'}) def test_add_payload(self): self.payload.add({'lazing': 'sunday'}) assert_true('lazing' in self.payload.data) assert_equal(self.payload.data['lazing'], 'sunday') def test_add_by_key(self): self.payload.add({'lazing': 'sunday'}, 'afternoon') assert_false('lazing' in self.payload.data) assert_true('afternoon' in self.payload.options) assert_true('lazing' in self.payload.options['afternoon']) assert_equal( self.payload.options['afternoon']['lazing'], 'sunday' ) def test_requests_get(self): out = self.payload.to_requests('get') assert_true('params' in out) assert_equal(list(out['params']), [('red', 'special')]) def test_requests_post(self): out = self.payload.to_requests('post') assert_true('data' in out) assert_equal(list(out['data']), [('red', 'special')])
class TestPayload(unittest.TestCase): def setUp(self): self.payload = Payload() self.payload.add({'red': 'special'}) def test_add_payload(self): self.payload.add({'lazing': 'sunday'}) assert_true('lazing' in self.payload.data) assert_equal(self.payload.data['lazing'], 'sunday') def test_add_by_key(self): self.payload.add({'lazing': 'sunday'}, 'afternoon') assert_false('lazing' in self.payload.data) assert_true('afternoon' in self.payload.options) assert_true('lazing' in self.payload.options['afternoon']) assert_equal(self.payload.options['afternoon']['lazing'], 'sunday') def test_requests_get(self): out = self.payload.to_requests('get') assert_true('params' in out) assert_equal(list(out['params']), [('red', 'special')]) def test_requests_post(self): out = self.payload.to_requests('post') assert_true('data' in out) assert_equal(list(out['data']), [('red', 'special')])
def setUp(self): self.payload = Payload() self.payload.add({'red': 'special'})