Ejemplo n.º 1
0
 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 = BoredomDetectorPlugin(123,456,None,args_string)
     self.test_subject.send_response = MagicMock()
Ejemplo n.º 2
0
 def test_constructor(self):
     """
     BoredomDetectorPlugin.__init__() Test plan:
         - make sure logger set right
         - make sure self.mongo is a mongo client
         - make sure db is a collection
         -check full name
     """
     
     BoredomDetectorPlugin.when.called_with(1234,5678,None).should.throw(Exception)
     
     args = {"transaction_management":"999"}
     args_string = shlex.quote(json.dumps(args))
     
     ds = BoredomDetectorPlugin(1234,5678,None,args_string)
     ds.logger.should.equal(None)
     isinstance(ds.mongo,MongoClient).should.equal(True)
     isinstance(ds.db,Collection).should.equal(True)
     ds.db.full_name.should.equal("hpit_unit_test_db.hpit_boredom_detection")
 
     isinstance(ds.config_db,Collection).should.equal(True)
     ds.config_db.full_name.should.equal("hpit_unit_test_db.hpit_boredom_config")