

def test_add_host(self):
    self.mox.StubOutWithMock(db, 'aggregate_host_add')
    db.aggregate_host_add(self.context, 123, 'bar').AndReturn({
        'host': 'bar',
    })
    self.mox.ReplayAll()
    agg = aggregate.Aggregate()
    agg.id = 123
    agg.hosts = ['foo']
    agg._context = agg.context
    agg.add_host('bar')
    self.assertEqual(agg.hosts, ['foo', 'bar'])

dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/tests/unit/objects/test_aggregate.py _TestAggregateObject.test_add_host/VarMisuse@80/106 `self`->`agg`