When you deploy code to production, all of your tests are run, and validation of overall code coverage takes place, as well as by trigger. Each trigger must be exercised in some way by a unit test, otherwise this validation will fail. I think your first step is writing some unit tests for the trigger(s) in question. Also, if you wish to delete classes or triggers, you can deploy those deletions by deploying your entire classes and triggers directories, minus the deleted metadata, from your sandbox. Beware though that your sandbox accurately represents production, because this will overwrite all classes and trigger in production with what is in your sandbox.
To test a callout, you need to "mock" it.
You will need to create a private inner class (well, you don't need to do it like that, but I find it easier) along the lines of:
private class GetAPIKeyMock implements HttpCalloutMock {
private Integer returnedStatusCode;
public GetAPIKeyMock(Integer returnedStatusCode) {
this.returnedStatusCode = returnedStatusCode;
}
public HTTPResponse respond(HTTPRequest req) {
// you can use System.assert here and "if" calls to check the request and affect your return if you wish
HttpResponse res = new HttpResponse();
res.setStatusCode(returnedStatusCode);
return res;
}
}
In this one, you tell it what status code you want to return in the "Mock" method, then when it is called, it will return a response with that value.. so you can use this to check your 200 case and your else..
Once you have this inner class, in your test class, you need to tell it to use the mock when the call out is called. So in your @isTest method add:
Test.setMock(HttpCalloutMock.class, new GetAPIKeyMock(200));
This tells your test method to use the GetAPIKeyMock class, and to return a HTTP 200 when it responds.
Best Answer
I think I found the error, but I think it's given from the plugin. Looking at the highlighted file in the screen above I removed all the irrelevant commas at the final element of a list.