def setUp(self): """ setup any state tied to the execution of the given method in a class. setup_method is invoked for every test method of a class. """ args = {"transaction_management":"999"} args_string = shlex.quote(json.dumps(args)) self.test_subject = StudentManagementPlugin(123,456,None,args_string) self.test_subject.logger = MagicMock() self.test_subject.send_log_entry = MagicMock()
def test_constructor(self): """ StudentManagementPlugin.__init__() Test plan: -ensure name, logger set as parameters -ensure that mongo is an instance of MongoClient -ensure that db is an instance of Collection -ensure that the full name is hpit.hpit_students """ args = {"transaction_management":"999"} args_string = shlex.quote(json.dumps(args)) smp = StudentManagementPlugin(123,456,None,args_string) isinstance(smp.mongo,MongoClient).should.equal(True) isinstance(smp.db,Collection).should.equal(True) smp.db.full_name.should.equal("hpit_unit_test_db.hpit_students")