def test_get_destination_user_with_user_from_juju_state(self): user = factory.make_User() # Also create another user. factory.make_User() node = factory.make_Node(owner=user) make_provider_state_file(node) self.assertEqual(user, get_destination_user())
def test_get_destination_user_with_orphaned_juju_state(self): user = factory.make_User() # Also create another user. factory.make_User() node = factory.make_Node(owner=user) make_provider_state_file(node) node.delete() # Orphan the state. self.assertEqual(get_legacy_user(), get_destination_user())
def test_migrate_all_nodes_to_bootstrap_owner_when_multiple_users(self): user1 = factory.make_User() node1 = factory.make_Node(owner=user1) user2 = factory.make_User() node2 = factory.make_Node(owner=user2) make_provider_state_file(node1) migrate() self.assertEqual( (user1, user1), (reload_object(node1).owner, reload_object(node2).owner))
def test_get_destination_user_with_orphaned_juju_state(self): user1, user2 = factory.make_user(), factory.make_user() node = factory.make_node(owner=user1) make_provider_state_file(node) node.delete() # Orphan the state. self.assertEqual(get_legacy_user(), get_destination_user())
def test_get_destination_user_with_user_from_juju_state(self): user1, user2 = factory.make_user(), factory.make_user() node = factory.make_node(owner=user1) make_provider_state_file(node) self.assertEqual(user1, get_destination_user())