def test_add_active_success_preserves_creation_time(self): """ If the server ID is not in the active list, ``add_active`` adds it along with server info, and does not change the server info's creation time. """ state = GroupState('tid', 'gid', 'name', {}, {}, None, {}, True, now=lambda: 'other_now') state.add_active('1', {'stuff': 'here', 'created': 'now'}) self.assertEqual(state.active, {'1': {'stuff': 'here', 'created': 'now'}})
def test_add_active_success_adds_creation_time(self): """ If the server ID is not in the active list, ``add_active`` adds it along with server info, and adds the creation time to server info that does not already have it. """ state = GroupState('tid', 'gid', 'name', {}, {}, None, {}, True, now=lambda: 'datetime') state.add_active('1', {'stuff': 'here'}) self.assertEqual(state.active, {'1': {'stuff': 'here', 'created': 'datetime'}})
def test_add_active_success_preserves_creation_time(self): """ If the server ID is not in the active list, ``add_active`` adds it along with server info, and does not change the server info's creation time. """ state = GroupState('tid', 'gid', {}, {}, None, {}, True, now=lambda: 'other_now') state.add_active('1', {'stuff': 'here', 'created': 'now'}) self.assertEqual(state.active, {'1': { 'stuff': 'here', 'created': 'now' }})
def test_add_active_success_adds_creation_time(self): """ If the server ID is not in the active list, ``add_active`` adds it along with server info, and adds the creation time to server info that does not already have it. """ state = GroupState('tid', 'gid', {}, {}, None, {}, True, now=lambda: 'datetime') state.add_active('1', {'stuff': 'here'}) self.assertEqual(state.active, {'1': { 'stuff': 'here', 'created': 'datetime' }})