in the 1960s and 1970s did people view cocaine as mostly a fun thing to do, but not necessarily addictive?
At what point did people realize cocaine was highly addictive, and a cocaine addiction could ruin your life?
You may be a bit mistaken, cocaine was widely used and known about since the 1850s. It was first isolated as an alkaloid in 1855, and was in popular use in Europe in the 1860s, and in the United States by the 1870s. My expertise lies in the 19th century, so until someone comes in with information about the 1960s, I can bring you up to speed a little.
For a long time cocaine was considered a safe drug for medicinal and recreational usage. It was touted as a safe anesthetic for localized surgery and as a way to treat rampant morphine/opium addictions. For example, the famous Dr. Sigmund Freud wrote extensively on the drug as an anesthetic. Into the 1900s cocaine could be found in many recreational products, famously in the original recipe of Coca-Cola until 1906, and in endless varieties of hocum patent-medicine with secret ingredients which peddled everywhere prior to the passage of the Pure Food and Drug Act in 1906. This act was passed, along with other progressive legislature, in the wave of increased awareness that people were adulterating with processed and packaged food and drinks to save money, or lying about the contents of items for the same reason.
The Pure Food and Drug Act required accurate labeling and measurements for ten types of "poisonous substances," including cocaine, whenever the drug was used as an additive or ingredient in food, drink, or medicine. This put an end to secret patent medicine and encouraged companies to stop including cocaine in their products since it was labeled by the government as dangerous poison. After 1906 cocaine was mainly sold as a prescription medicine or in pep-pills, but they fell out of use as well since the drug was still seen as bad for you.
Firstly, yes, as other commenters have mentioned, cocaine first came on the scene well before the 1960s (Sigmund Freud famously espoused its virtues years before becoming famous for his psychiatric theories).
Anyway, 1960s-1970s pop songs are probably as good a window to people's views on cocaine in the era as anything else. And in those songs, cocaine is predominantly presented negatively when it's explicitly mentioned. In the 1960s, the two most obvious cocaine songs were a country song and a folk song both called 'Cocaine Blues'.
The country song had been around since the 1940s, and was prominently covered by Johnny Cash on his late-sixties At Folsom Prison album. The song fairly clearly echoes the stereotypes of the violence and impulsivity of the cocaine user:
Early one mornin' while makin' the rounds
I took a shot of cocaine and shot my woman down
I went right home and I went to bed
I stuck that lovin' forty-four beneath my head.
The folk song of the same name (well, sometimes - it's variously called 'Cocaine', 'Cocaine Blues', 'Sweet Cocaine') was popularised by early 1960s folk pioneers like Dave Van Ronk and Davy Graham; it was then widely covered by singer-songwriters through the later 1960s and the 1970s - Nick Drake, Bob Dylan, Fred Neil, Jackson Browne, and Townes Van Zandt all did versions. Here's a couple of verses from the Dave Van Ronk version:
Every time my baby and me we go uptown,
Police come in and knock me down.
Cocaine run all around my brain.
Hey baby, better come here quick,
This old cocaine is 'bout to make me sick.
Cocaine run all around my brain.
The lyrics of that one fairly clearly point out its addictiveness and unhealthiness (Van Ronk sings later in the song that 'cocaine's for horses, not for men/ it's gonna kill me but I don't know when'), and the potential it causes for negative interactions with authority features. There's also a further variation on the song, done by Leadbelly to the Byrds, with similar themes and structure/phrasing but a different tag line, called 'Take A Whiff On Me'.
Elsewhere, The Grateful Dead's 1970 album Workingman's Dead has a prominent song, "Casey Jones" which mentions cocaine in the context of an old folk legend about a train driver:
Driving that train, high on cocaine,
Casey Jones you better watch your speed
For the Grateful Dead, the cocaine certainly impairs Casey's judgement in a dangerous way, seeing they're blaming cocaine usage for the train crash.
In Curtis Mayfield's 1972 soundtrack for Superfly (the songs of which were famously seen as an implicit rebuke to what Mayfield perceived as the blaxploitation film's glamorisation of the lifestyles of drug dealers), there's a track called 'No Thing On Me (Cocaine Song)' which is a fairly obvious warning about the dangers of addiction:
Twinkling twinkling grains
They do all sorts of things
While your inner mind is pleased
Your conscience is only teased
More and more you feed
Until you grow another need
Playing fantasy
You have no reality
And the people who were freely taking cocaine in the 1970s were well aware of the dangers of the drug; Stevie Nicks' song 'Gold Dust Woman' from the 1977 Fleetwood Mac album Rumours is fairly clearly a reference to the drug:
Rock on gold dust woman
Take your silver spoon
Dig your grave
And a recent interview with Nicks in Rolling Stone has her freely admitting the song is about cocaine, and that she had a monster habit in the 1980s that could have killed her.
As far as I can tell the closest thing to a positive message that's blatantly about cocaine in 1960s/1970s pop is in J.J. Cale's 1976 'Cocaine' (covered more famously by Eric Clapton):
If you got bad news, you want to kick them blues, cocaine
When your day is done and you want to run, cocaine
She don't lie, she don't lie, she don't lie, cocaine
So, yes, cocaine was not seen as a relatively harmless party drug in this era, if the pop lyrics of the time are any guide.