'This test creates two ResourceProviders, and attaches same trait to
both of them. Then detaching the trait from one of them, and ensure
the trait still associated with another one.'

def test_set_traits_for_correct_resource_provider(self):

    rp1 = objects.ResourceProvider(context=self.ctx, uuid=uuidsentinel.fake_resource_provider1, name=uuidsentinel.fake_resource_name1)
    rp1.create()
    rp2 = objects.ResourceProvider(context=self.ctx, uuid=uuidsentinel.fake_resource_provider2, name=uuidsentinel.fake_resource_name2)
    rp2.create()
    t = objects.Trait(self.ctx)
    t.name = 'CUSTOM_TRAIT_A'
    t.create()
    rp1.set_traits([t])
    rp2.set_traits([t])
    self._assert_traits(['CUSTOM_TRAIT_A'], rp1.get_traits())
    self._assert_traits(['CUSTOM_TRAIT_A'], rp2.get_traits())
    rp1.set_traits([])
    self._assert_traits([], rp1.get_traits())
    self._assert_traits(['CUSTOM_TRAIT_A'], rp2.get_traits())
