Example #1
0
 def setUp(self):
     '''
     this setup method is run before each test case is executed
     '''
     self.new_social_account = SocialAccounts(
         "twitter", "cherucole", "twitterPassword",
         "15")  #creating the social account object
 def test_save_multiple_social_account(self):
     '''
     test to check if we can save multiple social account details
     '''
     self.new_social_account.save_social_account()
     test_social_account = SocialAccounts("video","phoebe", "passvideo", "4") #new account to save
     test_social_account.save_social_account()
     self.assertEqual(len(SocialAccounts.social_accounts_list),2)
    def test_find_account_by_name(self):
        '''
        this is to enable users search their credentials by social account name e.g twitter and display the logins
        '''
        self.new_social_account.save_social_account()
        test_social_account = SocialAccounts("video","phoebe", "passvideo", "4") #new account to save
        test_social_account.save_social_account()

        found_social_account= SocialAccounts.find_account_by_name('video')
        self.assertEqual(found_social_account.social_account_username, test_social_account.social_account_username)
    def test_delete_social_account(self):
        '''
        this is to ensure we can remove a social account from our list
        '''
        self.new_social_account.save_social_account()
        test_social_account = SocialAccounts("video","phoebe", "passvideo", "4") #new account to save
        test_social_account.save_social_account()

        self.new_social_account.delete_social_account()
        self.assertEqual(len(SocialAccounts.social_accounts_list),1)
    def test_social_account_exists(self):
        '''
        we want to return a boolean if we cannot find a contact
        '''
        self.new_social_account.save_social_account()
        test_social_account = SocialAccounts("video","phoebe", "passvideo", "4") #new account to save
        test_social_account.save_social_account()

        account_exists= SocialAccounts.social_account_exists("video")
        self.assertTrue(account_exists)
Example #6
0
 def test_save_multiple_social_account(self):
     '''
     test to check if we can save multiple social account details
     '''
     self.new_social_account.save_social_account()
     test_social_account = SocialAccounts("musical.ly", "cherucole",
                                          "passmusic",
                                          "9")  #new account to save
     test_social_account.save_social_account()
     self.assertEqual(len(SocialAccounts.social_accounts_list), 2)
Example #7
0
    def test_social_account_exists(self):
        '''
        we want to return a boolean if we cannot find a contact
        '''
        self.new_social_account.save_social_account()
        test_social_account = SocialAccounts("musical.ly", "cherucole",
                                             "passmusic",
                                             "9")  #new account to save
        test_social_account.save_social_account()

        account_exists = SocialAccounts.social_account_exists("musical.ly")
        self.assertTrue(account_exists)
Example #8
0
    def test_delete_social_account(self):
        '''
        this is to ensure we can remove a social account from our list
        '''
        self.new_social_account.save_social_account()
        test_social_account = SocialAccounts("musical.ly", "cherucole",
                                             "passmusic",
                                             "9")  #new account to save
        test_social_account.save_social_account()

        self.new_social_account.delete_social_account()
        self.assertEqual(len(SocialAccounts.social_accounts_list), 1)
Example #9
0
    def test_find_account_by_name(self):
        '''
        this is to enable users search their credentials by social account name e.g twitter and display the logins
        '''
        self.new_social_account.save_social_account()
        test_social_account = SocialAccounts("musical.ly", "cherucole",
                                             "passmusic",
                                             "9")  #new account to save
        test_social_account.save_social_account()

        found_social_account = SocialAccounts.find_account_by_name(
            'musical.ly')
        self.assertEqual(found_social_account.social_account_username,
                         test_social_account.social_account_username)
Example #10
0
def check_existing_accounts(social_account):
    '''
    function that checks if social account exists and returns a boolean
    :param social_account:
    :return:
    '''
    return SocialAccounts.social_account_exists(social_account)
Example #11
0
def find_social_account(social_account):
    '''
    finding a social account and return its details
    :param social_account:
    :return:
    '''
    return SocialAccounts.find_account_by_name(social_account)
Example #12
0
def generate_acc_password():
    '''
    automatically generate the user password
    :return:
    '''
    auto_password=SocialAccounts.generate_acc_password()
    return auto_password
class TestSocialAccounts(unittest.TestCase):
    '''
    Test class that we define and test methods to use in the SocialAccount class
    '''
    def tearDown(self):
        '''
        this is to ensure each time the app is executed the list is clean
        '''
        SocialAccounts.social_accounts_list=[]

    def setUp(self):
        '''
        this setup method is run before each test case is executed
        '''
        self.new_social_account= SocialAccounts("facebook", "phoebe", "facebookPassword", "4") #creating the social account object

    def test_init(self):
        '''
        testing to ensure the social account object is initialized correctly
        '''
        self.assertEqual(self.new_social_account.social_account,"facebook")
        self.assertEqual(self.new_social_account.social_account_username,"phoebe")
        self.assertEqual(self.new_social_account.social_account_password,"facebookPassword")
        self.assertEqual(self.new_social_account.password_length,"4")


    def test_save_social_account(self):
        '''
        test case to see if the social account details are being saved to the list
        '''
        self.new_social_account.save_social_account() #saving the social account
        self.assertEqual(len(SocialAccounts.social_accounts_list),1)

    def test_save_multiple_social_account(self):
        '''
        test to check if we can save multiple social account details
        '''
        self.new_social_account.save_social_account()
        test_social_account = SocialAccounts("video","phoebe", "passvideo", "4") #new account to save
        test_social_account.save_social_account()
        self.assertEqual(len(SocialAccounts.social_accounts_list),2)

    def test_delete_social_account(self):
        '''
        this is to ensure we can remove a social account from our list
        '''
        self.new_social_account.save_social_account()
        test_social_account = SocialAccounts("video","phoebe", "passvideo", "4") #new account to save
        test_social_account.save_social_account()

        self.new_social_account.delete_social_account()
        self.assertEqual(len(SocialAccounts.social_accounts_list),1)

    def test_find_account_by_name(self):
        '''
        this is to enable users search their credentials by social account name e.g twitter and display the logins
        '''import pyperclip
Example #14
0
class TestSocialAccounts(unittest.TestCase):
    '''
    Test class that we define and test methods to use in the SocialAccount class
    '''
    def tearDown(self):
        '''
        this is to ensure each time the app is executed the list is clean
        '''
        SocialAccounts.social_accounts_list = []

    def setUp(self):
        '''
        this setup method is run before each test case is executed
        '''
        self.new_social_account = SocialAccounts(
            "twitter", "cherucole", "twitterPassword",
            "15")  #creating the social account object

    def test_init(self):
        '''
        testing to ensure the social account object is initialized correctly
        '''
        self.assertEqual(self.new_social_account.social_account, "twitter")
        self.assertEqual(self.new_social_account.social_account_username,
                         "cherucole")
        self.assertEqual(self.new_social_account.social_account_password,
                         "twitterPassword")
        self.assertEqual(self.new_social_account.password_length, "15")

    def test_save_social_account(self):
        '''
        test case to see if the social account details are being saved to the list
        '''
        self.new_social_account.save_social_account(
        )  #saving the social account
        self.assertEqual(len(SocialAccounts.social_accounts_list), 1)

    def test_save_multiple_social_account(self):
        '''
        test to check if we can save multiple social account details
        '''
        self.new_social_account.save_social_account()
        test_social_account = SocialAccounts("musical.ly", "cherucole",
                                             "passmusic",
                                             "9")  #new account to save
        test_social_account.save_social_account()
        self.assertEqual(len(SocialAccounts.social_accounts_list), 2)

    def test_delete_social_account(self):
        '''
        this is to ensure we can remove a social account from our list
        '''
        self.new_social_account.save_social_account()
        test_social_account = SocialAccounts("musical.ly", "cherucole",
                                             "passmusic",
                                             "9")  #new account to save
        test_social_account.save_social_account()

        self.new_social_account.delete_social_account()
        self.assertEqual(len(SocialAccounts.social_accounts_list), 1)

    def test_find_account_by_name(self):
        '''
        this is to enable users search their credentials by social account name e.g twitter and display the logins
        '''
        self.new_social_account.save_social_account()
        test_social_account = SocialAccounts("musical.ly", "cherucole",
                                             "passmusic",
                                             "9")  #new account to save
        test_social_account.save_social_account()

        found_social_account = SocialAccounts.find_account_by_name(
            'musical.ly')
        self.assertEqual(found_social_account.social_account_username,
                         test_social_account.social_account_username)

    def test_social_account_exists(self):
        '''
        we want to return a boolean if we cannot find a contact
        '''
        self.new_social_account.save_social_account()
        test_social_account = SocialAccounts("musical.ly", "cherucole",
                                             "passmusic",
                                             "9")  #new account to save
        test_social_account.save_social_account()

        account_exists = SocialAccounts.social_account_exists("musical.ly")
        self.assertTrue(account_exists)

    def test_display_all_social_accounts(self):
        '''
        method to show all the saved social accounts
        '''
        self.assertEqual(SocialAccounts.display_social_accounts(),
                         SocialAccounts.social_accounts_list)
Example #15
0
def create_social_account(account, username, password):
    '''
    function to create a new social account details
    '''
    new_social_account=SocialAccounts(account, username, password)
    return new_social_account
Example #16
0
 def test_display_all_social_accounts(self):
     '''
     method to show all the saved social accounts
     '''
     self.assertEqual(SocialAccounts.display_social_accounts(),
                      SocialAccounts.social_accounts_list)
 def setUp(self):
     '''
     this setup method is run before each test case is executed
     '''
     self.new_social_account= SocialAccounts("facebook", "phoebe", "facebookPassword", "4") #creating the social account object
Example #18
0
def display_all_social_accounts():
    '''
    function to display all stored social accounts
    :return:
    '''
    return SocialAccounts.display_social_accounts()


    # def test_copy_username(self):
    #     '''
    #     Test to confirm we are copying the username from a found account
    #     '''
    #     self.new_social_account.save_social_account()
    #     SocialAccounts.copy_username("facebook")
    #
    #     self.assertEqual(self.new_social_account.social_account_username,pyperclip.paste())

if __name__=='__main__':
    unittest.main()
        self.new_social_account.save_social_account()
        test_social_account = SocialAccounts("video","phoebe", "passvideo", "4") #new account to save
        test_social_account.save_social_account()

        found_social_account= SocialAccounts.find_account_by_name('video')
        self.assertEqual(found_social_account.social_account_username, test_social_account.social_account_username)

    def test_social_account_exists(self):
        '''
        we want to return a boolean if we cannot find a contact
        '''
        self.new_social_account.save_social_account()
        test_social_account = SocialAccounts("video","phoebe", "passvideo", "4") #new account to save
        test_social_account.save_social_account()

        account_exists= SocialAccounts.social_account_exists("video")
        self.assertTrue(account_exists)