def test_add_meter_to_building(self): """Add a meter to a building.""" bs = BuildingSnapshot.objects.create() bs.super_organization = self.org bs.save() fake_request = FakeRequest({}, user=self.fake_user, body=json.dumps({ 'organization_id': self.org.pk, 'building_id': bs.pk, 'meter_name': 'Fun', 'energy_type': 'Electricity', 'energy_units': 'kWh', })) expected = {'status': 'success'} resp = meters.add_meter_to_building(fake_request) self.assertDictEqual(json.loads(resp.content), expected)
def test_add_meter_to_building(self): """Add a meter to a building.""" bs = BuildingSnapshot.objects.create() bs.super_organization = self.org bs.save() fake_request = FakeRequest( {}, user=self.fake_user, body=json.dumps({ 'organization_id': self.org.pk, 'building_id': bs.pk, 'meter_name': 'Fun', 'energy_type': 'Electricity', 'energy_units': 'kWh', }) ) expected = {'status': 'success'} resp = meters.add_meter_to_building(fake_request) self.assertDictEqual(json.loads(resp.content), expected)