def main(): try: #App2().tls_connection() App2().hash_payload_hmac(App2().tls_connection()) App2().send_payload_sftp() #app2.tls_connection() except Exception as e: print(e)
def test_send_to_app3(self): """ Test will fail if it returns 'error' """ # instantiation app2 = App2() return_value = app2.send_to_app3() self.assertFalse(str(return_value).__contains__("error"))
def __init__(self, parent=None): super().__init__(parent) super().setupUi(self) self.jan2 = App2("ola mundo") self.pushButton.clicked.connect(self.mudajanela)
def display_page(pathname): if pathname == '/simple-stats': return App() if pathname == '/predictions': return App2() else: return Homepage()
def test_hash_data(self): """ Test will succeed if it returns True """ # in bytes json_msg = b'{"GeeksforGeeks":"dsda"}' # instantiation app2 = App2() hash_returned = app2.hash_data(json_msg) # test self.assertTrue(hash_returned)
def test_send_SFTP(self): ''' Test method for hash in App2 Compares boolean value True to the actual boolean value ''' payload = { "userId": 1, "id": 1, "title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit", "body": "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto" } result = App2.send_SFTP(payload) self.assertTrue(result)
def test_save_hash_to_disk(self): """ Test will succeed if it returns True """ import os import hmac import hashlib # in bytes json_msg = b'{"name": "mo"}' key = b'team4_secret_key' # hash sha256 = hmac.new(key, json_msg, hashlib.sha256).hexdigest() # instantiation app2 = App2() return_value = app2.save_file(json_msg, sha256) # test exists = os.path.isfile('group4_payload_hash.json') self.assertTrue(exists)
import dash from dash_multipage import MultiPageDashController from app1 import App1 from app2 import App2 from footer import render_footer from error_404 import render_404 # Bootstrap CSS for pretty navigation tabs APP = dash.Dash(__name__, external_stylesheets=[ 'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css']) # Pull flask app into namespace so it can be found for FLASK_APP SERVER = APP.server APP.title = "Multipage Dash Example" # This is how the URLS to initialize the app page states will start HOST_PATH = 'http://localhost:5000' # List of controllers for the app pages VIEW_CTRLS = [App1(HOST_PATH), App2(HOST_PATH)] # Initialize the multipage App PAGE_CTRL = MultiPageDashController( APP, VIEW_CTRLS, render_404(), render_footer()) if __name__ == '__main__': APP.run_server(debug=True)