Hi CryptoBuddha,
Your assertion should already be a requirement of the deletePerson function so it can’t be anything other than the msg.sender with out it failing, in this case you could just have accounts[1] === owner in the assertion but you would need to wrap it in truffleAssert.fails() not assert(). Side note: this won’t actually fail if you change ownership to accounts[1] prior.
Also, this assertion doesn’t really test whether a created person was deleted successfully or not. You could try creating a person (lets say “Alice”) and then delete Alice and test to see if Alice has been deleted or not by asserting that Alice no longer has a name, for example:
Create a Person first, then instantiate a variable with the getPerson function for the person that was created, i.e.
let createdPerson = await instance.getPerson();
then you can refer to the created person’s name through the instantiated variable.name to get the person’s name, e.g.
await instance.createdPerson.name
you could then asser that this name is == "Alice"
and then delete this person and assert that this name is now equal to nothing instead of “Alice” i.e. == ""
You could then try deleting the person from a different account by using a second argument {from: }
in the delete function which will tell the program who is calling the function (I suspect this is what you were trying to get at in your message as how to change the msg.sender). This argument defaults to account 0 when no argument is provided, but we can provide one like this:
await instance.deletePerson(accounts[0], {from: accounts[4]});
then an assertion that Alice is still named Alice will be true and a truflleAssert.fails function that specifies that Alice is no longer named Alice will work as you would expect this name not to have been deleted by anyone other than account[0] (the owner).
Hope this helps