That black and green one sure looks like the oil pressure sender, if it's screwed into the housing that the oil filter attaches to then it definitely is.
said about battery testers is correct. We have two testers at work, one is a load tester and the other is a small Midtronics tester that tests the battery in a way that doesn't use load. I've had batteries pass on the Midtronics tester but fail on the load tester and vise versa. Also, using a manual load tester and not applying the load for long enough can also give a false "good" test on a battery. Either of these could cause the the parts store to give an incorrect report on battery health.