'Check that duplicate usernames on different facilities properly validates.'

def test_form_duplicate_username_different_facility(self):

    user_form = FacilityUserForm(facility=self.facility, data=self.data)
    self.assertTrue(user_form.is_valid(), ('Form    must    be    valid;    instead:    errors    (%s)' % user_form.errors))
    user_form.instance.set_password(user_form.cleaned_data['password_first'])
    user_form.save()
    new_fac = Facility(name='test')
    new_fac.save()
    self.data['facility'] = new_fac.id
    self.data['first_name'] += '-different'
    self.data['group'] = None
    user_form = FacilityUserForm(facility=new_fac, data=self.data)
    self.assertTrue(user_form.is_valid(), ('Form    must    be    valid;    instead:    errors    (%s)' % user_form.errors))
