Example #1
0
    def __init__(self):
        self.settings = Settings()
        self.credentials = Credentials()
        self.display = Display()
        self.networkManager = NetworkManager()

        self.previous_hour1 = self.previous_hour2 = -1
        self.previous_minute1 = self.previous_minute2 = -1
        self.previous_second2 = self.previous_count = -1

        self.loop = get_event_loop()

        rst_cause = reset_cause()

        if rst_cause in [PWRON_RESET, SOFT_RESET]:
            self.power_on_reset_wkfl()
        elif rst_cause in [HARD_RESET]:
            self.hard_reset_wkfl()
        elif rst_cause == DEEPSLEEP_RESET:
            self.deepsleep_reset_wkfl()
        else:
            self.other_reset_wkfl()

        self.loop.run_forever()
        self.loop.close()
Example #2
0
def create_Credentials(credentials_name, user_name, phone_number, email):
    '''
        Function to create a new Credentials
        '''
    new_Credentials = Credentials(credentials_name, user_name, phone - number,
                                  email)
    return new_Credentials
Example #3
0
 def __init__(self):
     self.credentials = Credentials()
     self.api = twitter.Api(
         consumer_key=self.credentials.twitter_consumer_key,
         consumer_secret=self.credentials.twitter_consumer_secret,
         access_token_key=self.credentials.twitter_access_token_key,
         access_token_secret=self.credentials.twitter_access_token_secret)
Example #4
0
def create_credentials_account(account_user_name, password, account_name):
    '''
        Function to create a credential account
        '''
    new_credential_account = Credentials(account_user_name, password,
                                         account_name)
    return new_credential_account
Example #5
0
 def __init__(self):
     self.credentials = Credentials(USERNAME, PASSWORD)
     self.setBTC(self.getDefaultBTC())
     self.setUSD(self.getDefaultUSD())
     self.setPrint(self.getDefaultPrint())
     self.setSimulation(self.getDefaultSimulation())
     self.update()
Example #6
0
    def __init__(self):
        self.sta_if = WLAN(STA_IF)
        self.settings = Settings().load()
        self.credentials = Credentials().load()

        self.wifi = WifiManager(b"%s-%s" % (PUBLIC_NAME, self.settings.net_id))
        self.mdns = mDnsServer(PUBLIC_NAME.lower(), self.settings.net_id)

        routes = {
            b"/": b"./index.html",
            b"/index.html": b"./index.html",
            b"/scripts.js": b"./scripts.js",
            b"/style.css": b"./style.css",
            b"/favicon.ico": self.favicon,
            b"/connect": self.connect,
            b"/action/previous": self.previous,
            b"/action/next": self.next,
            b"/settings/values": self.settings_values,
            b"/settings/net": self.settings_net,
            b"/settings/group": self.settings_group,
        }

        self.http = HttpServer(routes)
        print("> HTTP server up and running")

        self.sign = Sign()

        self.loop = get_event_loop()
        self.loop.create_task(self.check_wifi())
        self.loop.run_forever()
        self.loop.close()
Example #7
0
    def __init__(self):
        self.sta_if = WLAN(STA_IF)
        self.settings = Settings().load()
        self.credentials = Credentials().load()

        self.wifi = WifiManager(b"%s-%s" % (PUBLIC_NAME, self.settings.net_id))
        self.mdns = mDnsServer(PUBLIC_NAME.lower(), self.settings.net_id)

        routes = {
            b"/": b"./index.html",
            b"/index.html": b"./index.html",
            b"/scripts.js": b"./scripts.js",
            b"/style.css": b"./style.css",
            b"/favicon.ico": self.favicon,
            b"/connect": self.connect,
            b"/settings/values": self.settings_values,
            b"/settings/net": self.settings_net,
            b"/settings/group": self.settings_group,
        }

        self.http = HttpServer(routes)
        print("> HTTP server up and running")

        self.display = Display()
        self.ntp = NtpTime()

        self.previous_hour1 = self.previous_hour2 = -1
        self.previous_minute1 = self.previous_minute2 = -1
        self.previous_second2 = self.previous_count = -1

        self.loop = get_event_loop()
        self.loop.create_task(self.check_wifi())
        self.loop.create_task(self.update_time())
        self.loop.run_forever()
        self.loop.close()
Example #8
0
 def setUp(self):
     '''
 the setup is a method that runs before each of the test cases is run
 creates a test user and his credentials
 '''
     self.new_user = User("Michael", "Cotts", 25, "*****@*****.**",
                          "zxcv456")
     self.new_credentials = Credentials("twitter", "mchcots", "qwerty123")
Example #9
0
	def __init__(self):


		self.credentialsBot = Credentials("oauth-tpnsbot.json")
		self.credentialsChannel = Credentials("oauth-fosse.json")

		self.token_str1 = self.credentialsBot.read()
		self.token_str2 = self.credentialsChannel.read()

		self.liveChatID = self.get_livechat_id()
		self.stopped = False
		self.messages = []

		if not self.liveChatID:
			print("[] No livestream found :(")
		else:
			print("Live Chat ID: ", self.liveChatID)
Example #10
0
 def test_saving_multiple_creds(self):
     '''
     checking if users can store multiple credentials
     '''
     self.new_cred.save_cred()
     test_cred = Credentials("Google", "obewas","obewas1202")
     test_cred.save_cred()
     self.assertEqual(len(Credentials.cred_list),2)
Example #11
0
 def test_confirm_cred_exists(self):
     '''
     confirm that credentials actually exists
     '''
     self.new_cred.save_cred()
     test_cred = Credentials("Google", "obewas","obewas1202")
     test_cred.save_cred()
     cred_exists = Credentials.cred_exists("Google")
     self.assertTrue(cred_exists)
 def test_save_multiple_Credentials(self):
     '''
     test_save_multiple_Credentials to check if we can save multiple Credentials
     objects to our Credentials_list
     '''
     self.new_Credentials.save_Credentials()
     test_Credentials = Credentials("", "", "")  # new contact
     test_Credentials.save_Credentials()
     self.assertEqual(len(Credentials.Credentials_list), 2)
Example #13
0
 def test_Credentials_exists(self):
         '''
         test to check if we can return a Boolean  if we cannot find the Credentials.
         '''
         self.new_Credentials.save_Credentials()
         test_Credentials =Credentials("Twitter","Anasimp","password") # new user
         test_Credentials.save_Credentials()
         Credentials_exists = Credentials.Credentials_exist("Twitter")
         self.assertTrue(Credentials_exists)
Example #14
0
 def __init__(self):
     self.URIS = {
         "Fox": "foxnews.com",
         "NYT": "nytimes.com",
         "Wash. Post": "washingtonpost.com",
         "BBC": "bbc.com",
         #"Vice News": "news.vice.com",
     }
     self.credentials = Credentials()
Example #15
0
 def test_delete_credentials(self):
     '''
     test if you can delete credentials test
     '''
     self.new_cred.save_cred()
     test_cred = Credentials("Google", "obewas","obewas1202")
     test_cred.save_cred()
     self.new_cred.delete_cred()
     self.assertEqual(len(Credentials.cred_list), 1)
Example #16
0
 def test_search_for_cred(self):
     '''
     test if credentials can be searched for
     '''
     self.new_cred.save_cred()
     test_cred = Credentials("Google", "obewas","obewas1202")
     test_cred.save_cred()
     find_cred= Credentials.find_account("Google")
     self.assertEqual(find_cred.account, test_cred.account)
 def test_save_multiple_Credentials(self):
     '''
     test_save_multiple_Credentials to check if we can save multiple Credentials
     objects to our Credentials_list
     '''
     self.new_Credentials.save__Credentials()
     test_Credentials = Credentials("instagram","aline","0783691714","*****@*****.**") # new Credentials
     test_Credentials.save__Credentials()
     self.assertEqual(len(Credentials.Credentials_list),2)
Example #18
0
 def test_save_multiple_Credentials(self):
         '''
         test_save_multiple_Credentials to check if we can save multiple Credentials
         objects to our Credentials_list
         '''
         self.new_Credentials.save_Credentials()
         test_Credentials = Credentials("Twitter","Anasimp","password") # new credentials
         test_Credentials.save_Credentials()
         self.assertEqual(len(Credentials.Credentials_list),2)
Example #19
0
    def test_delete_account(self):
        '''
    tests if the account can be deleted
    '''
        self.new_credentials.save_credentials()
        dummy_credentials = Credentials("facebook", "miahulf", "asdfg456")
        dummy_credentials.save_credentials()

        Credentials.credentials_list.remove(dummy_credentials)
        self.assertEqual(1, len(Credentials.credentials_list))
    def test_delete_Credentials(self):
        '''
            test_delete_Credentials to test if we can remove a credentials from our credential list
            '''
        self.new_Credentials.save_Credentials()
        test_Credentials = Credentials("", "", "")
        test_Credentials.save_Credentials()

        self.new_Credentials.delete_Credentials()
        self.assertEqual(len(Credentials.Credentials_list), 1)
Example #21
0
    def test_delete_Credentials(self):
            '''
            test_delete_Credentials to test if we can remove a credentials from our credentials list
            '''
            self.new_Credentials.save_Credentials()
            test_Credentials = Credentials("Twitter","Anasimp","password") # new Credentials
            test_Credentials.save_Credentials()

            self.new_Credentials.delete_Credentials()# Deleting a Credentials object
            self.assertEqual(len(Credentials.Credentials_list),1)
    def test_save_multiple_user_credentials(self):
        '''
        to check if we can save multiple user dredentials in our credential list

        '''
        self.new_user_credentials.save_user_credentials()
        test_new_credentials = Credentials("evelyn", "ev3",
                                           "linkedin")  # new credential
        test_new_credentials.save_user_credentials()
        self.assertEqual(len(Credentials.credentials_list), 2)
        def test_delete__Credentials(self):
            '''
            test_delete_Credentials to test if we can remove a Credentials from our Credentialslist
            '''
            self.new_Credentials.save__Credentials()
            test__Credentials = Credentials("instagram","rose","0788267443","*****@*****.**") # new Credentials
            test__Credentials.save__Credentials()

            self.new_Credentials.delete__Credentials()# Deleting a Credentials object
            self.assertEqual(len(Credentials.Credentials_list),1)
    def __init__(self, url, login, password, cluster):
        parsed_ambari_url = urllib2.urlparse(url)
        if parsed_ambari_url.scheme == '':
            self.scheme = 'http'
            self.host_and_port = parsed_ambari_url.path
        else:
            self.scheme = parsed_ambari_url.scheme
            self.host_and_port = parsed_ambari_url.netloc

        self.credentials = Credentials(login, password)
        self.cluster = cluster
Example #25
0
    def test_search_account(self):
        '''
    tests if you can search for a particular account
    '''
        self.new_credentials.save_credentials()
        dummy_credentials = Credentials("facebook", "miahulf", "asdfg456")
        dummy_credentials.save_credentials()

        account_exist = Credentials.search_account("facebook")

        self.assertEqual(dummy_credentials.account, account_exist.account)
        def test_Credentials_exists(self):
            '''
            test to check if we can return a Boolean  if we cannot find the Credentials.
            '''

            self.new_Credentials.save__Credentials()
            test_Credentials= Credentials("instagram","mazimpak","0786950337","*****@*****.**") # new Credentials
            test__Credentials.save__Credentials()

            Credentials_exists = Credentials. Credentials_exist("0786950337")

            self.assertTrue( Credentials_exists)
        def test_find__Credentials_by_number(self):
            '''
            test to check if we can find a Credentials by phone number and display information
            '''

            self.new_Credentials.save__Credentials()
            test__Credentials = Credentials("instagram","mazimpak","0786950337","*****@*****.**") # new Credentials
            test__Credentials.save__Credentials()

            found__Credentials= Credentials.find_by_number("0786950337")

            self.assertEqual(found__Credentials.email,test__Credentials.email) 
    def test_find_Credentials_by_site(self):
        '''
        test to check if we can find a Credentials
        '''

        self.new_Credentials.save_Credentials()
        test_Credentials = Credentials("", "", "")
        test_Credentials.save_Credentials()

        found_Credentials = Credentials.find_by_site("")

        self.assertEqual(found_Credentials.site, test_Credentials.site)
    def test_Credentials_exists(self):
        '''
        test to check if we can return a Boolean  if we cannot find the contact.
        '''

        self.new_Credentials.save_Credentials()
        test_Credentials = Credentials("", "", "")
        test_Credentials.save_Credentials()

        Credentials_exists = Credentials.Credentials_exist("")

        self.assertTrue(Credentials_exists)
Example #30
0
    def test_find_credentials_by_name(self):
        '''
        test to check if we can find a Credentials by phone name and display information
        '''

        self.new_Credentials.save_Credentials()
        # self.new_Credentials.save_Credentials()
        test_Credentials = Credentials("Twitter","Anasimp","password") # new Credentials
        test_Credentials.save_Credentials()

        found_Credentials = Credentials.find_by_name("Twitter")

        self.assertEqual(found_Credentials.user_name,test_Credentials.user_name)