| Conditions | 1 | 
| Total Lines | 52 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 2 | ||
| Bugs | 0 | Features | 0 | 
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | #!/usr/bin/env python  | 
            ||
| 69 | def test_run(self):  | 
            ||
| 70 | pack = 'dummy_pack_1'  | 
            ||
| 71 | # Verify all the resources are there  | 
            ||
| 72 | |||
| 73 | pack_dbs = Pack.query(ref=pack)  | 
            ||
| 74 | action_dbs = Action.query(pack=pack)  | 
            ||
| 75 | alias_dbs = ActionAlias.query(pack=pack)  | 
            ||
| 76 | rule_dbs = Rule.query(pack=pack)  | 
            ||
| 77 | sensor_dbs = Sensor.query(pack=pack)  | 
            ||
| 78 | trigger_type_dbs = TriggerType.query(pack=pack)  | 
            ||
| 79 | policy_dbs = Policy.query(pack=pack)  | 
            ||
| 80 | |||
| 81 | config_schema_dbs = ConfigSchema.query(pack=pack)  | 
            ||
| 82 | config_dbs = Config.query(pack=pack)  | 
            ||
| 83 | |||
| 84 | self.assertEqual(len(pack_dbs), 1)  | 
            ||
| 85 | self.assertEqual(len(action_dbs), 1)  | 
            ||
| 86 | self.assertEqual(len(alias_dbs), 2)  | 
            ||
| 87 | self.assertEqual(len(rule_dbs), 1)  | 
            ||
| 88 | self.assertEqual(len(sensor_dbs), 1)  | 
            ||
| 89 | self.assertEqual(len(trigger_type_dbs), 3)  | 
            ||
| 90 | self.assertEqual(len(policy_dbs), 2)  | 
            ||
| 91 | |||
| 92 | self.assertEqual(len(config_schema_dbs), 1)  | 
            ||
| 93 | self.assertEqual(len(config_dbs), 1)  | 
            ||
| 94 | |||
| 95 | # Run action  | 
            ||
| 96 | action = self.get_action_instance()  | 
            ||
| 97 | action.run(packs=[pack])  | 
            ||
| 98 | |||
| 99 | # Make sure all resources have been removed from the db  | 
            ||
| 100 | pack_dbs = Pack.query(ref=pack)  | 
            ||
| 101 | action_dbs = Action.query(pack=pack)  | 
            ||
| 102 | alias_dbs = ActionAlias.query(pack=pack)  | 
            ||
| 103 | rule_dbs = Rule.query(pack=pack)  | 
            ||
| 104 | sensor_dbs = Sensor.query(pack=pack)  | 
            ||
| 105 | trigger_type_dbs = TriggerType.query(pack=pack)  | 
            ||
| 106 | policy_dbs = Policy.query(pack=pack)  | 
            ||
| 107 | |||
| 108 | config_schema_dbs = ConfigSchema.query(pack=pack)  | 
            ||
| 109 | config_dbs = Config.query(pack=pack)  | 
            ||
| 110 | |||
| 111 | self.assertEqual(len(pack_dbs), 0)  | 
            ||
| 112 | self.assertEqual(len(action_dbs), 0)  | 
            ||
| 113 | self.assertEqual(len(alias_dbs), 0)  | 
            ||
| 114 | self.assertEqual(len(rule_dbs), 0)  | 
            ||
| 115 | self.assertEqual(len(sensor_dbs), 0)  | 
            ||
| 116 | self.assertEqual(len(trigger_type_dbs), 0)  | 
            ||
| 117 | self.assertEqual(len(policy_dbs), 0)  | 
            ||
| 118 | |||
| 119 | self.assertEqual(len(config_schema_dbs), 0)  | 
            ||
| 120 | self.assertEqual(len(config_dbs), 0)  | 
            ||
| 121 |