That is because it is never called. The first line of your program does this:
my_library = __import__("my_module")
The next line just overshadows the first. It does not alter my_module in any way, thus all your other code just calls the original code instead of the mock.
Take a look at mock.patch
instead. Either like this:
from mock import patch
import my_module as my_library
class MyTest(TestCase):
def test_add(self):
acronym = 'TEST'
with patch.object(my_library, 'add') as add_method:
m = MyModel(acronym=acronym)
m.save()
add_method.assert_called_with(acronym=acronym)
Or using the original module name:
from mock import patch
class MyTest(TestCase):
def test_add(self):
acronym = 'TEST'
with patch('my_module.add') as add_method:
m = MyModel(acronym=acronym)
m.save()
add_method.assert_called_with(acronym=acronym)