def test_get_display_group_id_WHEN_multi_same_THEN_returns_first(self): with mock_database.Database(): obj = mock_database.GamDisplaygroup.create(dg_name="test1") mock_database.GamDisplaygroup.create(dg_name="test1") self.assertEqual(db_func.get_display_group_id("test1"), obj.dg_id)
def test_get_display_group_id_WHEN_not_present_THEN_returns_none(self): with mock_database.Database(): mock_database.GamDisplaygroup.create(dg_name="test2") self.assertIsNone(db_func.get_display_group_id("test1"))
def test_get_display_group_id_WHEN_multi_present_THEN_returns_correct( self): with mock_database.Database(): mock_database.GamDisplaygroup.create(dg_name="test1") obj = mock_database.GamDisplaygroup.create(dg_name="test2") self.assertEqual(db_func.get_display_group_id("test2"), obj.dg_id)
def test_display_group_id_WHEN_no_connection_THEN_returns_none(self): self.assertIsNone(db_func.get_display_group_id("test1"))