Пример #1
0
    def test_max_identities(self):
        dbcon = self.get_db_identities_con()
        # Check there are no person with more than max_ids
        max_ids = "15"
        q = """
            select count(id) as total, upeople_id 
            from identities 
            group by upeople_id 
            having total>=%s order by total 
            desc limit 1
        """ % (
            max_ids
        )
        res = check_array_values(dbcon.ExecuteQuery(q))
        self.assertEqual(len(res["total"]), 0, res)

        # Check there are no more than max_people with max_ids
        max_ids = "10"
        max_people = "20"
        q = """
            select count(id) as total, upeople_id 
            from identities 
            group by upeople_id 
            having total>=%s order by total 
            desc limit %s
        """ % (
            max_ids,
            max_people,
        )
        res = dbcon.ExecuteQuery(q)
        self.assertTrue(
            len(res["total"]) < int(max_people),
            "More than " + max_people + " person with more than " + max_ids + " identities",
        )
Пример #2
0
    def test_max_identities(self):
        dbcon = self.get_db_identities_con()
        # Check there are no person with more than max_ids
        max_ids = "15"
        q = """
            select count(id) as total, upeople_id 
            from identities 
            group by upeople_id 
            having total>=%s order by total 
            desc limit 1
        """ % (max_ids)
        res = check_array_values(dbcon.ExecuteQuery(q))
        self.assertEqual(len(res['total']), 0, res)

        # Check there are no more than max_people with max_ids
        max_ids = "10"
        max_people = "20"
        q = """
            select count(id) as total, upeople_id 
            from identities 
            group by upeople_id 
            having total>=%s order by total 
            desc limit %s
        """ % (max_ids, max_people)
        res = dbcon.ExecuteQuery(q)
        self.assertTrue(
            len(res['total']) < int(max_people), "More than " + max_people +
            " person with more than " + max_ids + " identities")
Пример #3
0
 def test_max_emails(self):
     dbcon = self.get_db_identities_con()
     # Check there are no person with more than max_ids
     max_emails = "10"
     q = """
         select count(distinct(identity)) as total_emails, upeople_id 
         from identities
         WHERE type = 'email'
         group by upeople_id
         having total_emails>=%s 
         order by total_emails 
         desc limit 1
     """ % (max_emails)
     res = check_array_values(dbcon.ExecuteQuery(q))
     self.assertEqual(len(res['total_emails']), 0, res)
Пример #4
0
 def test_max_emails(self):
     dbcon = self.get_db_identities_con()
     # Check there are no person with more than max_ids
     max_emails = "10"
     q = """
         select count(distinct(identity)) as total_emails, upeople_id 
         from identities
         WHERE type = 'email'
         group by upeople_id
         having total_emails>=%s 
         order by total_emails 
         desc limit 1
     """ % (
         max_emails
     )
     res = check_array_values(dbcon.ExecuteQuery(q))
     self.assertEqual(len(res["total_emails"]), 0, res)