Example #1
0
def tariffList(params):
	try:
		ret = map(lambda c: c.values, tariffs.get_all())

	except Exception, e:
		LOG.error(e)
		return jsonrpc.result_error('ServerError',
			{ 'status': 'error', 'message': 'Unable to obtain tariff list' })
Example #2
0
	def test_tariff_get_all(self):
		"""Check getting tariffs from db"""

		data = []
		for i in range(2, 10):
			d = {
				'id':           unicode(uuid.uuid4()),
				'name':         str(uuid.uuid4()),
				'description':  str(uuid.uuid4()),
				'state':        tariffs.constants.STATE_ENABLED,
				'time_create':  int(time.time()),
				'time_destroy': 0,
			}

			with database.DBConnect() as db:
				db.insert('tariffs', d)

			data.append(tariffs.Tariff(d))

		self.assertEquals(set(list(tariffs.get_all())), set(data))