def test_push_facilities_with_locations(self): # create dummy data self._create_state() self._create_municipality() municipality = Municipality.newest() state = State.newest() municipality.parent = state municipality.save() clinic1 = Clinic(id=1, name=u"Clinic A", code="1A2B", municipality=municipality) clinic1.save() # test push_facilities service response = push_facilities(self.request) self.assertEqual(1, len(response['rows']))
def test_can_register_new_municipality_users(self): self._create_municipality() ona_user = OnaUser.get(OnaUser.username == 'manager_a') user = ona_user.user old_user_count = User.count() municipality = Municipality.newest() self.request.context = user self.request.method = 'POST' params = MultiDict({'email': "*****@*****.**", 'username': "******", 'password': {'password': '******', 'password-confirm': 'password'}, 'group': groups.MUNICIPALITY_MANAGER, 'municipality': "{}".format(municipality.id)}) self.request.POST = params response = self.view.register() self.assertEqual(User.count(), old_user_count + 1) self.assertEqual(response.status_code, 302)