def test_query_one(self): self.turn.resource_turn_query_one() sql = 'select count(*) from customer' result = Utility.query_one('../config/base.conf', sql) print(result) if result[0] == 27: actual = 'query-pass' else: actual = 'query-fail' self.assertEqual(actual, 'query-pass')
def test_alloacation_commit_two(self): self.allocation.excute_ratio_commit() sql = 'select work_id from customer' result = Utility.query_one('../config/base.conf', sql) try: if 0 not in result: actual = 'query-pass' else: actual = 'query-fail' self.assertEqual(actual, 'query-pass') except Exception: raise Exception
def test_alloacation_commit_one(self, ): self.allocation.excute_manual_commit() sql = 'select work_id from customer where name="ww"' result = Utility.query_one('../config/base.conf', sql) try: if result[0] != 0: actual = 'query-pass' else: actual = 'query-fail' self.assertEqual(actual, 'query-pass') except Exception: raise Exception
def test_alloacation_query_three(self, name): self.allocation.allocation_query_three(name) sql = 'select count(*) from customer where name="%s"' % name result = Utility.query_one('../config/base.conf', sql) try: if result[0] == 1: actual = 'query-pass' else: actual = 'query-fail' self.assertEqual(actual, 'query-pass') except Exception: raise Exception
def test_alloacation_query_two(self): self.allocation.allocation_query_two() sql = 'select count(source) from customer where work_id="0"' result = Utility.query_one('../config/base.conf', sql) try: if result[0] == 8: actual = 'query-pass' else: actual = 'query-fail' self.assertEqual(actual, 'query-pass') except Exception: raise Exception
def test_query_two(self): self.turn.resource_turn_query_two() sql = 'select count(*) from customer where name="huhu"' result = Utility.query_one('../config/base.conf', sql) print(result) try: if self.driver.find_element_by_xpath('//table[@id="transmit-table"]/tbody/tr[1]/td[2]').text == 'huhu' \ and result[0] == 1: actual = 'query-pass' else: actual = 'query-fail' self.assertEqual(actual, 'turn-pass') except Exception: raise Exception