예제 #1
0
    def setUpST(self):
        if self.__dict__.has_key("st"):
            return

        username = testconfig.get("slimtimer", "username")
        password = testconfig.get("slimtimer", "password")
        api_key = testconfig.get("slimtimer", "api_key")

        self.st = slimtimer.SlimTimerSession(username, password, api_key)
예제 #2
0
    def setUpST(self):
        if self.__dict__.has_key('st'):
            return

        username = testconfig.get('slimtimer', 'username')
        password = testconfig.get('slimtimer', 'password')
        api_key = testconfig.get('slimtimer', 'api_key')

        self.st = slimtimer.SlimTimerSession(username, password, api_key)
예제 #3
0
    def setUpST(self):
        if self.__dict__.has_key('st'):
            return

        username = testconfig.get('slimtimer', 'username')
        password = testconfig.get('slimtimer', 'password')
        api_key  = testconfig.get('slimtimer', 'api_key')

        self.st = ST.SlimTimerSession(username, password, api_key)
예제 #4
0
    def setUpStore(self):
        if self.__dict__.has_key("ts"):
            return

        db_host = testconfig.get("database", "host")
        db_user = testconfig.get("database", "username")
        db_password = testconfig.get("database", "password")
        db_database = testconfig.get("database", "database")

        self.ts = time_store.TimeStore(host=db_host, user=db_user, password=db_password, database=db_database)
예제 #5
0
    def setUpStore(self):
        if self.__dict__.has_key('ts'):
            return

        db_host = testconfig.get('database', 'host')
        db_user = testconfig.get('database', 'username')
        db_password = testconfig.get('database', 'password')
        db_database = testconfig.get('database', 'database')

        self.ts = time_store.TimeStore(host=db_host,
                                       user=db_user,
                                       password=db_password,
                                       database=db_database)
예제 #6
0
    def setUpStore(self):
        if self.__dict__.has_key('ts'):
            return

        db_host     = testconfig.get('database', 'host')
        db_user     = testconfig.get('database', 'username')
        db_password = testconfig.get('database', 'password')
        db_database = testconfig.get('database', 'database')

        self.ts = TS.TimeStore(host = db_host,
                               user = db_user,
                               password = db_password,
                               database = db_database)
예제 #7
0
    def setUpUsers(self):
        config_file = testconfig.get('users', 'config_file')
        if not os.path.isfile(config_file):
            self.fail("User configuration file %s is not available"
                    % config_file)

        self.users = users.Users(config_file)
예제 #8
0
    def setUpUsers(self):
        if self.__dict__.has_key("users"):
            return

        config_file = testconfig.get("users", "config_file")
        if not os.path.isfile(config_file):
            self.fail("User configuration file %s is not available" % config_file)

        self.users = users.Users(config_file)
예제 #9
0
    def setUpUsers(self):
        if self.__dict__.has_key('users'):
            return

        config_file = testconfig.get('users', 'config_file')
        if not os.path.isfile(config_file):
            self.fail("User configuration file %s is not available" %
                      config_file)

        self.users = users.Users(config_file)
예제 #10
0
    def test_basic(self):
        """
        One fat test to cover everything. This should be factored into separate
        tests.
        """

        #
        # We're going to make a task called "New task". If a previous test run
        # failed this task might already exist so let's check and delete it if
        # it does.
        #
        existing = self.st.get_task_by_name("New task")
        if existing:
            existing.delete()
        assert(self.st.get_task_by_name("New task") == None)

        #
        # Ok, create "New task"
        #
        new_task = ST.SlimTimerTask(self.st, "New task")

        #
        # Check the results of the contructor
        #
        self.assertEqual(new_task.id, 0)
        self.assertEqual(new_task.name, "New task")
        self.assertEqual(new_task.complete, False)
        self.assertEqual(new_task.owner, "")
        self.assertEqual(new_task.created_at, 0)
        self.assertEqual(new_task.updated_at, 0)
        self.assertEqual(new_task.completed_on, 0)

        # 
        # Set some test data
        #
        new_task.tags = ['tag 1', 'tag 2']
        new_task.coworkers = ['*****@*****.**', '*****@*****.**']
        new_task.reporters = ['*****@*****.**']

        #
        # Create in ST
        #
        new_task.update()
        self.assertNotEqual(new_task.id, 0)
        new_task_id = new_task.id

        #
        # Retrieve the task and test
        #
        new_task = None
        result = self.st.get_task_by_id(new_task_id)
        self.assertNotEqual(result, None)
        self.assertEqual(result.id, new_task_id)
        self.assertEqual(result.name, "New task")
        self.assertEqual(result.hours, 0)
        self.assertEqual(result.complete, False)
        self.assertEqual(result.tags, ['tag 1', 'tag 2'])
        self.assertEqual(result.coworkers, ['*****@*****.**', '*****@*****.**'])
        self.assertEqual(result.reporters, ['*****@*****.**'])
        self.assertEqual(result.owner, testconfig.get('slimtimer', 'username'))
        self.assertNotEqual(result.created_at, 0)
        self.assertNotEqual(result.updated_at, 0)
        self.assertEqual(result.completed_on, 0)

        #
        # Retrieve by name
        #
        result = self.st.get_task_by_name("New task")
        self.assertNotEqual(result, None)
        self.assertEqual(result.id, new_task_id)

        #
        # Delete
        #
        result.delete()
        result = self.st.get_task_by_id(new_task_id)
        self.assertEqual(result, None)
        result = self.st.get_task_by_name("New task")
        self.assertEqual(result, None)
예제 #11
0
    def test_basic(self):
        """
        One fat test to cover everything. This should be factored into separate
        tests.
        """

        #
        # We're going to make a task called "New task". If a previous test run
        # failed this task might already exist so let's check and delete it if
        # it does.
        #
        existing = self.st.get_task_by_name("New task")
        if existing:
            existing.delete()
        assert (self.st.get_task_by_name("New task") == None)

        #
        # Ok, create "New task"
        #
        new_task = ST.SlimTimerTask(self.st, "New task")

        #
        # Check the results of the contructor
        #
        self.assertEqual(new_task.id, 0)
        self.assertEqual(new_task.name, "New task")
        self.assertEqual(new_task.complete, False)
        self.assertEqual(new_task.owner, "")
        self.assertEqual(new_task.created_at, 0)
        self.assertEqual(new_task.updated_at, 0)
        self.assertEqual(new_task.completed_on, 0)

        #
        # Set some test data
        #
        new_task.tags = ['tag 1', 'tag 2']
        new_task.coworkers = ['*****@*****.**', '*****@*****.**']
        new_task.reporters = ['*****@*****.**']

        #
        # Create in ST
        #
        new_task.update()
        self.assertNotEqual(new_task.id, 0)
        new_task_id = new_task.id

        #
        # Retrieve the task and test
        #
        new_task = None
        result = self.st.get_task_by_id(new_task_id)
        self.assertNotEqual(result, None)
        self.assertEqual(result.id, new_task_id)
        self.assertEqual(result.name, "New task")
        self.assertEqual(result.hours, 0)
        self.assertEqual(result.complete, False)
        self.assertEqual(result.tags, ['tag 1', 'tag 2'])
        self.assertEqual(result.coworkers, ['*****@*****.**', '*****@*****.**'])
        self.assertEqual(result.reporters, ['*****@*****.**'])
        self.assertEqual(result.owner, testconfig.get('slimtimer', 'username'))
        self.assertNotEqual(result.created_at, 0)
        self.assertNotEqual(result.updated_at, 0)
        self.assertEqual(result.completed_on, 0)

        #
        # Retrieve by name
        #
        result = self.st.get_task_by_name("New task")
        self.assertNotEqual(result, None)
        self.assertEqual(result.id, new_task_id)

        #
        # Delete
        #
        result.delete()
        result = self.st.get_task_by_id(new_task_id)
        self.assertEqual(result, None)
        result = self.st.get_task_by_name("New task")
        self.assertEqual(result, None)