Пример #1
0
class ScoreWall(Wall):
	userListScore = []

	def __init__(self, canvas, jenkins_url, score_view, dbname):
		Wall.__init__(self, canvas, jenkins_url)

		self.funnycats = FunnyCats(self.jenkins, score_view, dbname)
		self.funnycats.init()
		self.users_score = None

	def update_info(self):
		try:
			if self.funnycats.is_connected() is False:
				raise Exception
			self.funnycats.update_view_score()
			self.users_score = get_user_list_score()
		except Exception, e:
			logging.error(e)
			self.error()
Пример #2
0
    def setUp(self):
        self.funnycats = FunnyCats(self.jenkins, "Score", "funnycats_tests")
        self.funnycats.connect_db()
        self.funnycats.clear_db()

        self.user1 = User()
        self.user1.name = "User1"
        self.user1.score = 3
        self.user1.save()

        self.user2 = User()
        self.user2.name = "User2"
        self.user2.score = 10
        self.user2.save()

        self.user3 = User()
        self.user3.name = "User3"
        self.user3.score = 9
        self.user3.save()
Пример #3
0
class ScoreWall(Wall):
    userListScore = []

    def __init__(self, canvas, jenkins_url, score_view, dbname):
        Wall.__init__(self, canvas, jenkins_url)

        self.funnycats = FunnyCats(self.jenkins, score_view, dbname)
        self.funnycats.init()
        self.users_score = None

    def update_info(self):
        try:
            if self.funnycats.is_connected() is False:
                raise Exception
            self.funnycats.update_view_score()
            self.users_score = get_user_list_score()
        except Exception, e:
            logging.error(e)
            self.error()
Пример #4
0
class FunnyCatsWall(Wall):
    userListScore = []

    def __init__(self, canvas, jenkins, score_view, dbname):
        Wall.__init__(self, canvas, jenkins)

        self.funnycats = FunnyCats(self.jenkins, score_view, dbname)
        self.funnycats.init()
        self.users_score = None

    def update_info(self):
        try:
            if self.funnycats.is_connected() is False:
                return False
            self.funnycats.update_score_view()
            self.users_score = get_user_list_score()
            return True
        except Exception, e:
            logging.error(e)
            return False
Пример #5
0
class FunnyCatsWall(Wall):
	userListScore = []

	def __init__(self, canvas, jenkins, score_view, dbname):
		Wall.__init__(self, canvas, jenkins)

		self.funnycats = FunnyCats(self.jenkins, score_view, dbname)
		self.funnycats.init()
		self.users_score = None

	def update_info(self):
		try:
			if self.funnycats.is_connected() is False:
				return False
			self.funnycats.update_score_view()
			self.users_score = get_user_list_score()
			return True
		except Exception, e:
			logging.error(e)
			return False
Пример #6
0
class TestsUser(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        cls.jenkins = mock.Mock()

    def setUp(self):
        self.funnycats = FunnyCats(self.jenkins, "Score", "funnycats_tests")
        self.funnycats.connect_db()
        self.funnycats.clear_db()

        self.user1 = User()
        self.user1.name = "User1"
        self.user1.score = 3
        self.user1.save()

        self.user2 = User()
        self.user2.name = "User2"
        self.user2.score = 10
        self.user2.save()

        self.user3 = User()
        self.user3.name = "User3"
        self.user3.score = 9
        self.user3.save()

    def tearDown(self):
        self.funnycats.disconnect_db()

    def test_get_user_list_score(self):
        users = get_user_list_score()
        self.assertTrue(3, len(users))
        self.assertEquals(self.user2.name, users[0]["name"])
        self.assertEquals(self.user3.name, users[1]["name"])
        self.assertEquals(self.user1.name, users[2]["name"])
Пример #7
0
	def setUp(self):
		self.funnycats = FunnyCats(self.jenkins, "Score", "funnycats_tests")
		self.funnycats.connect_db()
		self.funnycats.clear_db()

		self.user1 = User()
		self.user1.name = "User1"
		self.user1.score = 3
		self.user1.save()

		self.user2 = User()
		self.user2.name = "User2"
		self.user2.score = 10
		self.user2.save()

		self.user3 = User()
		self.user3.name = "User3"
		self.user3.score = 9
		self.user3.save()
Пример #8
0
class TestScoreJob(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        cls.jenkins = mock.Mock()

    def setUp(self):
        self.funnycats = FunnyCats(self.jenkins, "Score", "funnycats_tests")
        self.funnycats.connect_db()
        self.funnycats.clear_db()

    def tearDown(self):
        self.funnycats.disconnect_db()

    def test_need_to_add_job(self):
        job = ScoreJob()
        job.name = "Job1"
        job.save()

        self.assertFalse(need_to_add_job("Job1"))
        self.assertTrue(need_to_add_job("Job2"))
Пример #9
0
class TestsScoreJob(unittest.TestCase):
	@classmethod
	def setUpClass(cls):
		cls.jenkins = mock.Mock()

	def setUp(self):
		self.funnycats = FunnyCats(self.jenkins, "Score", "funnycats_tests")
		self.funnycats.connect_db()
		self.funnycats.clear_db()


	def tearDown(self):
		self.funnycats.disconnect_db()

	def test_need_to_add_job(self):
		job = ScoreJob()
		job.name = "Job1"
		job.save()

		self.assertFalse(need_to_add_job("Job1"))
		self.assertTrue(need_to_add_job("Job2"))
Пример #10
0
class TestsUser(unittest.TestCase):
	@classmethod
	def setUpClass(cls):
		cls.jenkins = mock.Mock()

	def setUp(self):
		self.funnycats = FunnyCats(self.jenkins, "Score", "funnycats_tests")
		self.funnycats.connect_db()
		self.funnycats.clear_db()

		self.user1 = User()
		self.user1.name = "User1"
		self.user1.score = 3
		self.user1.save()

		self.user2 = User()
		self.user2.name = "User2"
		self.user2.score = 10
		self.user2.save()

		self.user3 = User()
		self.user3.name = "User3"
		self.user3.score = 9
		self.user3.save()


	def tearDown(self):
		self.funnycats.disconnect_db()


	def test_get_user_list_score(self):
		users = get_user_list_score()
		self.assertTrue(3, len(users))
		self.assertEquals(self.user2.name, users[0]["name"])
		self.assertEquals(self.user3.name, users[1]["name"])
		self.assertEquals(self.user1.name, users[2]["name"])
Пример #11
0
	def setUp(self):
		self.funnycats = FunnyCats(self.jenkins, "Score", "funnycats_tests")
		self.funnycats.connect_db()
		self.funnycats.clear_db()
Пример #12
0
    def __init__(self, canvas, jenkins, score_view, dbname):
        Wall.__init__(self, canvas, jenkins)

        self.funnycats = FunnyCats(self.jenkins, score_view, dbname)
        self.funnycats.init()
        self.users_score = None
Пример #13
0
	def __init__(self, canvas, jenkins_url, score_view, dbname):
		Wall.__init__(self, canvas, jenkins_url)

		self.funnycats = FunnyCats(self.jenkins, score_view, dbname)
		self.funnycats.init()
		self.users_score = None
Пример #14
0
 def setUp(self):
     self.funnycats = FunnyCats(self.jenkins, "Score", "funnycats_tests")
     self.funnycats.connect_db()
     self.funnycats.clear_db()