def test_few_companies_exists(self): input_data = { 'SkyBet': { 'country1': 'odd1.1', 'country2': 'odd1.2', 'country3': 'odd1.3', }, 'Bet365': { 'country1': 'odd2.1', 'country2': 'odd2.2', 'country3': 'odd2.3', }, 'Paddy': { 'country1': 'odd3.1', 'country2': 'odd3.2', } } self.assertEqual( { 'keys': ['Bet365', 'Paddy', 'SkyBet'], 'data': [ ('country1', ['odd2.1', 'odd3.1', 'odd1.1']), ('country2', ['odd2.2', 'odd3.2', 'odd1.2']), ('country3', ['odd2.3', 'odd1.3']), ] }, merge_results(input_data) )
def test_one_company_exists(self): input_data = { 'SkyBet': { 'country1': 'odd1', 'country2': 'odd2', 'country3': 'odd3', } } self.assertEqual( { 'keys': ['SkyBet'], 'data': [ ('country1', ['odd1']), ('country2', ['odd2']), ('country3', ['odd3']), ] }, merge_results(input_data) )
def test_empty_data(self): self.assertEqual( {'keys': [], 'data': []}, merge_results(dict()) )
def save_file(): data = merge_results(dict(app.results)) return send_file( filename_or_fp=get_attachment(data), mimetype='application/vnd.ms-excel', )
def refresh(): """ Returns table in current state without updating anything """ data = merge_results(dict(app.results)) return render_template('table.html', data=data)