def lookupCombos(self):
        # This iterates over the self.combos array and looks up whether each
        # is recorded already

        c = Combo()
        c.connectDB()

        for group in self.combos:

            self.log.message(str(group))

            group['combos'] = c.lookupCombos(
                group['player1'],
                group['player2']
            )

            # There should be four id values:
            # both, neither, one, and the other
            # Just looking at counts isn't enough, but it is a start.
            if(len(group['combos']) == 4):
                # No action needed
                self.log.message('All present')
            elif(len(group['combos']) == 0):
                # None exist - so we create them
                self.log.message('Create all')
                c.registerCombo(
                    group['player1'],
                    group['player2']
                )
            else:
                # Some other number exists. WTF?
                self.log.message('Some present')
                raise RuntimeError('Incorrect number of combinations found')

            self.log.message('')

        c.disconnectDB()

        return True
Exemple #2
0
def test_combo_disconnect():
    c = Combo()
    c.connectDB()
    assert hasattr(c, 'db')
    c.disconnectDB()
    assert hasattr(c, 'db') is False