def test_initialise(self): # Act test_round0 = rnd.Round() test_round1 = rnd.Round(1) test_round2 = rnd.Round(1, 1) # Assess self.assertIsInstance(test_round0, rnd.Round) self.assertEqual(test_round0.server_id, -1) self.assertEqual(test_round0.round_id, -1) self.assertEqual(test_round1.server_id, 1) self.assertEqual(test_round1.round_id, -1) self.assertEqual(test_round2.server_id, 1) self.assertEqual(test_round2.round_id, 1)
def test_round_initialise_when_no_people_exist(self, op1, op2): # Arrange test_round = rnd.Round() # Act val = test_round.initialise_round() # Assert self.assertEqual(test_round.server_id, -1) self.assertEqual(test_round.round_id, -1)
def test_delete(self): # Arrange test_round = rnd.Round(4, 5) # Act test_round.delete_round() # Assess self.assertEqual(test_round.server_id, -1) self.assertEqual(test_round.round_id, -1)
def test_setters(self): # Arrange test_round = rnd.Round() # Act test_round.set_server_id(44) test_round.set_round_id(15) # Assess self.assertEqual(test_round.server_id, 44) self.assertEqual(test_round.round_id, 15)
def test_round_initialise_when_round_does_not_exist( self, op1, op2, op3, db_new_round): # Arrange test_round = rnd.Round() # Act val = test_round.initialise_round() # Assert self.assertEqual(test_round.server_id, 2) db_new_round.assert_called_once() self.assertTrue(val)
def test_round_initialise_when_round_exists(self, op1, op2, db_get_server_id): # Arrange test_round = rnd.Round() # Act val = test_round.initialise_round() # Assert self.assertEqual(test_round.round_id, 6) db_get_server_id.assert_called_once() self.assertTrue(val)