Update last_active_at for agents

We are building an app that needs to look at an agent last_activity_at field.

In order to get testdata (so that we can pass code coverage ), we need to updates some agents in our app.

However, not able to change that field.

How should we go on to test our app the best way, as of right now we can´t clim above the 80 % benchmark for marketplace apps due to this issue.

Hey @Ansfs91,

If I understood correctly, the app is updating the last_active_at time for the agent, and the API which is updating is failing with the error message you have attached. Because the API is not going into a success case, the code coverage is not going above 80% and you are reaching out to ask how this case is to ensure 80% and above code coverage.

Can you tell me which API this is and what else the app is intended to solve?

Sure. :slight_smile:

The app is going to delete agents after a certain amount of time in months, based don their last_activity.

However, since this is data we can´t change it is hard to test with agents.

Understood. :+1:

And I’m assuming that this is a Serverless app that is triggered by a scheduled event. Which would use the list agents API to get the agents and compare the last_active_at timestamp.

And for testing, you would need agents who have an old date for last_active_at. Based on the error from the update agent API, last_active_at is not a supported field.

Can you confirm if the app you are building is for Freshservice?

That is all correct. :slight_smile:

& when we get a hit of an agent that haven´t been active for a while we call the apu again and to DEL with the /forget endpoint request on the agent.

When you come across an agent who hasn’t been active for while and then uses the forget API, then do the code coverage standards satisfied?

What’s the time period considered to identify someone as an inactive agent and you can delete them?

It did yeah,

The time will be dependent on the customer that has installed the app. With a minimum of one month, however customers can also check the box so that the app only deletes tickets and requesters and doesnt search for agents at all.

So the question is; how to fake the data (on a read only field) so that we can get an agent to delete in order to get higher code coverage?

Hey Albin,

As we discussed, having an agent created only for the purpose for this API testing would be the way to go.

Hope this was helpful to you.

1 Like

This topic was automatically closed 6 days after the last reply. New replies are no longer allowed.