South Africa beat India by seven wickets in second Test at Johannesburg to level three-match series 1-1.