def _insert_favorite(): """Insert starting default entries into the Favorite table. Args: None Returns: None """ # Insert into Favorite if favorite.idx_exists(1) is False: favorite.insert_row( DbRowFavorite(idx_chart=1, idx_user=1, order=0, enabled=0))
def test_idx_exists(self): """Testing method or function named "idx_exists".""" # Add user entry to database uname = data.hashstring(str(random())) passwrd = data.hashstring(str(random())) salt_ = data.hashstring(str(random())) f_name = data.hashstring(str(random())) l_name = data.hashstring(str(random())) user.insert_row( DbRowUser(username=uname, password=passwrd, first_name=f_name, last_name=l_name, role=1, password_expired=1, enabled=0)) # Make sure user entry exists idx_user = user.exists(uname) self.assertTrue(bool(idx_user)) # Add chart entry to database chart_name = data.hashstring(str(random())) chart_checksum = data.hashstring(str(random())) chart.insert_row( DbRowChart(name=chart_name, checksum=chart_checksum, enabled=0)) # Make sure chart entry exists idx_chart = chart.exists(chart_checksum) self.assertTrue(bool(idx_chart)) # Add favorite to database favorite.insert_row( DbRowFavorite(idx_chart=idx_chart, idx_user=idx_user, order=0, enabled=0)) # Make sure the favorite exists idx_favorite = favorite.exists(idx_chart, idx_user) # Verify that the index exists result = favorite.idx_exists(idx_favorite) self.assertTrue(result)
def test__insert_favorite(self): """Testing method or function named "_insert_favorite".""" _insert_favorite() result = favorite.idx_exists(1) self.assertTrue(result)