def setUp(self): super(TestServiceUsagesApi, self).setUp() self.resource = 'serviceusages' self.user = User.objects.create_user('ralph', '*****@*****.**', 'ralph') date2datetime = lambda d: datetime.datetime.combine( d, datetime.datetime.min.time()) self.date = datetime.date(2013, 10, 10) self.datetime = date2datetime(self.date) self.today = datetime.date.today() self.today_datetime = date2datetime(self.today) self.service = Service(name='Service1', symbol='s1') self.service.save() self.venture1 = Venture( name='Venture1', venture_id=1, symbol='v1', is_active=True, ) self.venture1.save() self.venture2 = Venture( name='Venture2', venture_id=2, symbol='v2', is_active=True, ) self.venture2.save() self.venture3 = Venture( name='Venture3', venture_id=3, symbol='v3', is_active=True, ) self.venture3.save() self.inactive_venture = Venture( name='Venture4', venture_id=4, symbol='v4', is_active=False, ) self.inactive_venture.save() self.usage_type1 = UsageType(name='UsageType1', symbol='ut1') self.usage_type1.save() self.usage_type2 = UsageType(name='UsageType2', symbol='ut2') self.usage_type2.save() self.api_key = self.create_apikey( self.user.username, self.user.api_key.key, )
def setUp(self): self.venture = get_or_create_venture() self.venture2 = get_or_create_venture() self.device = get_or_create_device(device_id=1) self.usage_type = UsageType( name='Usage1', symbol='ut1', ) self.usage_type.save() self.today = date.today()