def test_index_with_multiple_users(NipsaUser): nipsa_user1 = mock.Mock() nipsa_user1.userid = "test_id1" nipsa_user2 = mock.Mock() nipsa_user2.userid = "test_id2" nipsa_user3 = mock.Mock() nipsa_user3.userid = "test_id3" NipsaUser.all.return_value = [nipsa_user1, nipsa_user2, nipsa_user3] assert logic.index() == ["test_id1", "test_id2", "test_id3"]
def test_index_with_no_users(NipsaUser): NipsaUser.all.return_value = [] assert logic.index() == []
def test_index_with_one_user(NipsaUser): nipsa_user = mock.Mock() nipsa_user.userid = "test_id" NipsaUser.all.return_value = [nipsa_user] assert logic.index() == ["test_id"]