# Path: prometapi/compat.py
# def zlib_encode(data):
# 	if isinstance(data, type(u'')):
# 		data = data.encode('utf-8')
# 	return base64.b64encode(zlib.compress(data))


import unittest
import os
		import codecs
	import sys
from prometapi.compat import zlib_encode
		from prometapi.encoders import encrypt, decrypt
		from django.test.client import Client
		from prometapi.models import parse_burja, parse_burjaznaki, parse_counters, parse_events, parse_parkirisca_lpt
		from prometapi.models import Burja, BurjaZnaki, Counters, Events, ParkiriscaLPT
		from prometapi.models import _decode, _loads, _dumps
			from prometapi import models
		obj = ParkiriscaLPT(json_data=_dumps(json), original_data=zlib_encode(_dumps([park, occu])))
		obj.save()
		
		# GET
		c = Client()
		
		resp = c.get('/promet/events/')
		self.assertEqual(resp.status_code, 200)
		json = _loads(resp.content)
		self.assertEqual(type(json), type({}))
		resp = c.get('/promet/burja/')
		self.assertEqual(resp.status_code, 200)
		json = _loads(resp.content)
		self.assertEqual(type(json), type({}))
		resp = c.get('/promet/burjaznaki/')
		self.assertEqual(resp.status_code, 200)
		json = _loads(resp.content)
		self.assertEqual(type(json), type({}))
		resp = c.get('/promet/counters/')
		self.assertEqual(resp.status_code, 200)
		json = _loads(resp.content)
		self.assertEqual(type(json), type({}))
		resp = c.get('/promet/parkirisca/lpt/')
		self.assertEqual(resp.status_code, 200)
		json = _loads(resp.content)
		self.assertEqual(type(json), type({}))
		
		
		


# Path: prometapi/compat.py
# def zlib_encode(data):
# 	if isinstance(data, type(u'')):
# 		data = data.encode('utf-8')
# 	return base64.b64encode(zlib.compress(data))


# Path: prometapi/tests.py
import unittest
import os
		import codecs
	import sys
from prometapi.compat import zlib_encode
		from prometapi.encoders import encrypt, decrypt
		from django.test.client import Client
		from prometapi.models import parse_burja, parse_burjaznaki, parse_counters, parse_events, parse_parkirisca_lpt
		from prometapi.models import Burja, BurjaZnaki, Counters, Events, ParkiriscaLPT
		from prometapi.models import _decode, _loads, _dumps
			from prometapi import models

		obj = ParkiriscaLPT(json_data=_dumps(json), original_data=zlib_encode(_dumps([park, occu])))
		obj.save()
		
		# GET
		c = Client()
		
		resp = c.get('/promet/events/')
		self.assertEqual(resp.status_code, 200)
		json = _loads(resp.content)
		self.assertEqual(type(json), type({}))
		resp = c.get('/promet/burja/')
		self.assertEqual(resp.status_code, 200)
		json = _loads(resp.content)
		self.assertEqual(type(json), type({}))
		resp = c.get('/promet/burjaznaki/')
		self.assertEqual(resp.status_code, 200)
		json = _loads(resp.content)
		self.assertEqual(type(json), type({}))
		resp = c.get('/promet/counters/')
		self.assertEqual(resp.status_code, 200)
		json = _loads(resp.content)
		self.assertEqual(type(json), type({}))
		resp = c.get('/promet/parkirisca/lpt/')
		self.assertEqual(resp.status_code, 200)
		json = _loads(resp.content)
		self.assertEqual(type(json), type({}))
		
		
		


if __name__ == "__main__":