def setUpClass(self):
     self._l1 = LogIn()
     self._c = self._l1.login()
     self.ss_client = self._c[0]
     self.doc_client = self._c[1]
Example #2
0
 def setUpClass(self):
     self._l1 = LogIn()
     self._c = self._l1.login()
     self.ss_client = self._c[0]
     self.doc_client = self._c[1]
class LoginTest(unittest.TestCase):

    # CLASS VARIABLES
    # defined as global variables because we are testing units here
    # if these are declared to be returned from another test case, -
    # - succeeding tests will depend on the previous tests
    # otherwise login will be needed for every other test case

    @classmethod
    def setUpClass(self):
        self._l1 = LogIn()
        self._c = self._l1.login()
        self.ss_client = self._c[0]
        self.doc_client = self._c[1]

    """
    Test id= 1
        Unit to test = g2sagemathlogin.LogIn.login()
        Assumptions= correct authentication code is given
        Test data= a valid authentication code
        Steps 
        1. Run the test 
        2. follow instructions on the terminal
        
        Expected result= a value of type "gdata.spreadsheet.service.SpreadsheetsService"
    """

    def test_login_output0(self):

        try:
            self.assertEqual(
                str(type(self.ss_client)),
                "<class 'gdata.spreadsheet.service.SpreadsheetsService'>")
        except:
            self.assertRaises(SystemExit)

    """
    Test id= 2
        Unit to test = g2sagemathlogin.LogIn.logIn()
        Assumptions= 
        Test data= 
        Steps 
               
        Expected result=
    """

    def test_login_output1(self):
        try:
            self.assertEqual(str(type(self.doc_client)),
                             "<class 'gdata.docs.service.DocsService'>")
        except:
            self.assertRaises(SystemExit)

    """
    Test id= 3
        Unit to test = g2sagemathlogin.LogIn.logIn()
        Assumptions= 
        Test data= 
        Steps 
               
        Expected result=
    """

    def test_login_output_size(self):

        self.assertEqual(len(self._c), 2)

    """
    Test id= 4
        Unit to test = g2sagemathlogin.LogIn.Oauth2Login()
        Assumptions= 
        Test data= 
        Steps 
        1. Run the test 
        2. follow instructions on the terminal
        
        Expected result= a value of type "gdata.spreadsheet.service.SpreadsheetsService"
    """

    @unittest.skip("not used in this phase of g2sagemath ")
    def test_oauth2login(self):
        pass

    """
    Test id= 5
        Unit to test = g2sagemathlogin.LogIn.ShowDrive()
        Assumptions= 
        Test data= 
        Steps 
               
        Expected result=
    """

    def test_showdrive_output_type(self):

        d = [self.ss_client]
        try:
            out_list = self._l1.show_drive(data_arg=d)
            self.assertEqual(type(out_list), type([]))
        except:
            self.assertRaises(SystemExit)

    """
    Test id= 6
        Unit to test = g2sagemathlogin.LogIn.ShowDrive()
        Assumptions= 
        Test data= 
        Steps 
                 
        Expected result= 
    """

    def test_showdrive_output_size(self):

        try:
            out_list = self._l1.show_drive([self.ss_client, self.doc_client])
            self.assertEqual(len(out_list), 4)

        except:
            self.assertRaises(SystemExit)

    """
    Test id= 7
        Unit to test = g2sagemathlogin.LogIn.ShowDrive()
        Assumptions= 
        Test data= 
        Steps 
                 
        Expected result= 
    """

    def test_showdrive_output_content_0(self):

        try:
            out_list = self._l1.show_drive([self.ss_client, self.doc_client])
            self.assertEqual(
                str(type(out_list[0])),
                "<class 'gdata.spreadsheet.service.SpreadsheetsService'>")
        except:
            self.assertRaises(SystemExit)

    """
    Test id= 8
        Unit to test = g2sagemathlogin.LogIn.ShowDrive()
        Assumptions= 
        Test data= 
        Steps 
                 
        Expected result= 
    """

    def test_showDrive_output_content_1(self):

        try:
            out_list = self._l1.show_drive([self.ss_client, self.doc_client])
            self.assertEqual(str(type(out_list[1])),
                             "<class 'gdata.GDataFeed'>")
        except:
            self.assertRaises(SystemExit)

    """
    Test id= 9
        Unit to test = g2sagemathlogin.LogIn.ShowDrive()
        Assumptions= 
        Test data= 
        Steps 
                 
        Expected result= 
    """

    def test_showDrive_output_content_2(self):

        try:
            out_list = self._l1.show_drive([self.ss_client, self.doc_client])
            self.assertEqual(type(out_list[2]), type([]))
        except:
            self.assertRaises(SystemExit)

    """
    Test id= 10
        Unit to test = g2sagemathlogin.LogIn.ShowDrive()
        Assumptions= 
        Test data= 
        Steps 
                 
        Expected result= 
    """

    def test_showDrive_output_content_3(self):
        try:
            out_list = self._l1.show_drive([self.ss_client, self.doc_client])
            self.assertEqual(str(type(out_list[3])),
                             "<class 'gdata.docs.service.DocsService'>")
        except:
            self.assertRaises(SystemExit)

    """
    Test id= 11
        Unit to test = g2sagemathlogin.LogIn.UserChoice()
        Assumptions= 
        Test data= 
        Steps 
        
         
        Expected result= 
    """

    def test_userchoice_output(self):
        arg = self._l1.show_drive([self.ss_client, self.doc_client])
        try:
            out_list = self._l1.user_choice(ssdata_arg=arg)
            self.assertEquals(len(out_list), 5)

        except:
            self.assertRaises(SystemExit)

    """
Example #4
0
class LoginTest(unittest.TestCase):

    # CLASS VARIABLES
    # defined as global variables because we are testing units here
    # if these are declared to be returned from another test case, -
    # - succeeding tests will depend on the previous tests
    # otherwise login will be needed for every other test case

    @classmethod
    def setUpClass(self):
        self._l1 = LogIn()
        self._c = self._l1.login()
        self.ss_client = self._c[0]
        self.doc_client = self._c[1]

    """
    Test id= 1
        Unit to test = g2sagemathlogin.LogIn.login()
        Assumptions= correct authentication code is given
        Test data= a valid authentication code
        Steps 
        1. Run the test 
        2. follow instructions on the terminal
        
        Expected result= a value of type "gdata.spreadsheet.service.SpreadsheetsService"
    """

    def test_login_output0(self):

        try:
            self.assertEqual(str(type(self.ss_client)), "<class 'gdata.spreadsheet.service.SpreadsheetsService'>")
        except:
            self.assertRaises(SystemExit)

    """
    Test id= 2
        Unit to test = g2sagemathlogin.LogIn.logIn()
        Assumptions= 
        Test data= 
        Steps 
               
        Expected result=
    """

    def test_login_output1(self):
        try:
            self.assertEqual(str(type(self.doc_client)), "<class 'gdata.docs.service.DocsService'>")
        except:
            self.assertRaises(SystemExit)

    """
    Test id= 3
        Unit to test = g2sagemathlogin.LogIn.logIn()
        Assumptions= 
        Test data= 
        Steps 
               
        Expected result=
    """

    def test_login_output_size(self):

        self.assertEqual(len(self._c), 2)

    """
    Test id= 4
        Unit to test = g2sagemathlogin.LogIn.Oauth2Login()
        Assumptions= 
        Test data= 
        Steps 
        1. Run the test 
        2. follow instructions on the terminal
        
        Expected result= a value of type "gdata.spreadsheet.service.SpreadsheetsService"
    """

    @unittest.skip("not used in this phase of g2sagemath ")
    def test_oauth2login(self):
        pass

    """
    Test id= 5
        Unit to test = g2sagemathlogin.LogIn.ShowDrive()
        Assumptions= 
        Test data= 
        Steps 
               
        Expected result=
    """

    def test_showdrive_output_type(self):

        d = [self.ss_client]
        try:
            out_list = self._l1.show_drive(data_arg=d)
            self.assertEqual(type(out_list), type([]))
        except:
            self.assertRaises(SystemExit)

    """
    Test id= 6
        Unit to test = g2sagemathlogin.LogIn.ShowDrive()
        Assumptions= 
        Test data= 
        Steps 
                 
        Expected result= 
    """

    def test_showdrive_output_size(self):

        try:
            out_list = self._l1.show_drive([self.ss_client, self.doc_client])
            self.assertEqual(len(out_list), 4)

        except:
            self.assertRaises(SystemExit)

    """
    Test id= 7
        Unit to test = g2sagemathlogin.LogIn.ShowDrive()
        Assumptions= 
        Test data= 
        Steps 
                 
        Expected result= 
    """

    def test_showdrive_output_content_0(self):

        try:
            out_list = self._l1.show_drive([self.ss_client, self.doc_client])
            self.assertEqual(str(type(out_list[0])), "<class 'gdata.spreadsheet.service.SpreadsheetsService'>")
        except:
            self.assertRaises(SystemExit)

    """
    Test id= 8
        Unit to test = g2sagemathlogin.LogIn.ShowDrive()
        Assumptions= 
        Test data= 
        Steps 
                 
        Expected result= 
    """

    def test_showDrive_output_content_1(self):

        try:
            out_list = self._l1.show_drive([self.ss_client, self.doc_client])
            self.assertEqual(str(type(out_list[1])), "<class 'gdata.GDataFeed'>")
        except:
            self.assertRaises(SystemExit)

    """
    Test id= 9
        Unit to test = g2sagemathlogin.LogIn.ShowDrive()
        Assumptions= 
        Test data= 
        Steps 
                 
        Expected result= 
    """

    def test_showDrive_output_content_2(self):

        try:
            out_list = self._l1.show_drive([self.ss_client, self.doc_client])
            self.assertEqual(type(out_list[2]), type([]))
        except:
            self.assertRaises(SystemExit)

    """
    Test id= 10
        Unit to test = g2sagemathlogin.LogIn.ShowDrive()
        Assumptions= 
        Test data= 
        Steps 
                 
        Expected result= 
    """

    def test_showDrive_output_content_3(self):
        try:
            out_list = self._l1.show_drive([self.ss_client, self.doc_client])
            self.assertEqual(str(type(out_list[3])), "<class 'gdata.docs.service.DocsService'>")
        except:
            self.assertRaises(SystemExit)

    """
    Test id= 11
        Unit to test = g2sagemathlogin.LogIn.UserChoice()
        Assumptions= 
        Test data= 
        Steps 
        
         
        Expected result= 
    """

    def test_userchoice_output(self):
        arg = self._l1.show_drive([self.ss_client, self.doc_client])
        try:
            out_list = self._l1.user_choice(ssdata_arg=arg)
            self.assertEquals(len(out_list), 5)

        except:
            self.assertRaises(SystemExit)

    """