Skip to content

Commit

Permalink
move back to controller only test
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinFasusi committed Nov 7, 2017
1 parent 9c8c60b commit 677f6de
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 39 deletions.
1 change: 0 additions & 1 deletion supplychainpy/reporting/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,6 @@ def load(file_path: str, location: str = None):
simple_forecast = parallelise_ses(pickled_ses_batch_files=pickled_paths, core_count=cores)
except:
simple_forecast = {}

cleanup_pickled_files()

try:
Expand Down
76 changes: 38 additions & 38 deletions tests/test_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,41 +17,41 @@
logging.basicConfig(level=logging.WARNING, format='%(asctime)s - %(levelname)s - %(message)s')


class TestBot(TestCase):
def setUp(self):
self.__dude = ChatBot()
self.__SALUTATION_RESPONSES = ["hi", "hello", "how's tricks?"]
app = Flask(__name__, instance_relative_config=True)
PWD = os.path.abspath(os.curdir)
i_c = IntegrationConfig
i_c.SQLALCHEMY_DATABASE_URI ='sqlite:///{}/reporting.db'.format(PWD)
app.config.from_object(i_c)

app.config['DATABASE'] = PWD
app.config['TESTING'] = True
self.app = app.test_client()

file_path = ABS_FILE_PATH['COMPLETE_CSV_XSM']
app_settings = {
'file': file_path,
'currency': 'USD',
'database_path': PWD,
}
serialise_config(app_settings, ABS_FILE_PATH_APPLICATION_CONFIG)
with app.app_context():
db.init_app(app)
db.create_all()
load_db(file=file_path,location=PWD)

def test_chat_bot(self):
greeting1 = self.__dude.chat_machine("hello")[0]
self.assertIn(*greeting1, self.__SALUTATION_RESPONSES)
#print(self.__dude.chat_machine("show KR202-214")[0])
#self.assertEqual('<a href="/sku_detail/36">Here you go!</a>', self.__dude.chat_machine("show KR202-244")[0])
#self.assertIn('SKU KR202-247', *self.__dude.chat_machine("what is the biggest shortage?")[0])
#self.assertIn('SKU KR202-247', *self.__dude.chat_machine("what is the biggest excess?")[0])
#self.assertIn('SKU KR202-235', *self.__dude.chat_machine("what is the biggest revenue?")[0])
#self.assertIn('SKU KR202-212', *self.__dude.chat_machine("what is the smallest revenue?")[0])
#self.assertIn('SKU KR202-245', *self.__dude.chat_machine("what is the smallest excess?")[0])
#self.assertIn('SKU KR202-213', *self.__dude.chat_machine("Which SKU has the smallest average order?")[0])
#self.assertIn('SKU KR202-241', *self.__dude.chat_machine("Which SKU has the greatest safety stock?")[0])
#class TestBot(TestCase):
# def setUp(self):
# self.__dude = ChatBot()
# self.__SALUTATION_RESPONSES = ["hi", "hello", "how's tricks?"]
# app = Flask(__name__, instance_relative_config=True)
# PWD = os.path.abspath(os.curdir)
# i_c = IntegrationConfig
# i_c.SQLALCHEMY_DATABASE_URI ='sqlite:///{}/reporting.db'.format(PWD)
# app.config.from_object(i_c)
#
# app.config['DATABASE'] = PWD
# app.config['TESTING'] = True
# self.app = app.test_client()
#
# file_path = ABS_FILE_PATH['COMPLETE_CSV_XSM']
# app_settings = {
# 'file': file_path,
# 'currency': 'USD',
# 'database_path': PWD,
# }
# serialise_config(app_settings, ABS_FILE_PATH_APPLICATION_CONFIG)
# with app.app_context():
# db.init_app(app)
# db.create_all()
# load_db(file=file_path,location=PWD)
#
# def test_chat_bot(self):
# greeting1 = self.__dude.chat_machine("hello")[0]
# self.assertIn(*greeting1, self.__SALUTATION_RESPONSES)
# #print(self.__dude.chat_machine("show KR202-214")[0])
# #self.assertEqual('<a href="/sku_detail/36">Here you go!</a>', self.__dude.chat_machine("show KR202-244")[0])
# #self.assertIn('SKU KR202-247', *self.__dude.chat_machine("what is the biggest shortage?")[0])
# #self.assertIn('SKU KR202-247', *self.__dude.chat_machine("what is the biggest excess?")[0])
# #self.assertIn('SKU KR202-235', *self.__dude.chat_machine("what is the biggest revenue?")[0])
# #self.assertIn('SKU KR202-212', *self.__dude.chat_machine("what is the smallest revenue?")[0])
# #self.assertIn('SKU KR202-245', *self.__dude.chat_machine("what is the smallest excess?")[0])
# #self.assertIn('SKU KR202-213', *self.__dude.chat_machine("Which SKU has the smallest average order?")[0])
# #self.assertIn('SKU KR202-241', *self.__dude.chat_machine("Which SKU has the greatest safety stock?")[0])

0 comments on commit 677f6de

Please sign in to comment.