Ejemplo n.º 1
0
    def test_createOrUpdate(self):
        os.environ['OPENSHIFT_MONGODB_DB_URL']=u"mongodb://*****:*****@127.0.0.1:27017/euroxxxvi"
        mgr = BetsManager()
        self.assertIsNotNone(mgr.getDb())
        bet = Bet()
        bet.resultA=1
        bet.resultB=10
        bet.user_id="moi_en_uuid"
        bet.com_id="ma_com_id_en_uuid"
        bet.category="categcode"
        bet.categoryName="categname"
        bet.key="keymatch"
        bet.libteamA="theliba"
        bet.libteamB="thelibb"
        bet.teamA="theteamA"
        bet.teamB="theteamb"
        bet.dateDeadLineBet=datetime(2016, 6, 2, 18, 15, 0, 0, tzinfo=timezone.utc)
        bet.dateMatch=datetime(2016, 6, 2, 18, 15, 0, 0, tzinfo=timezone.utc)

        mgr.createOrUpdate(bet)

        bets = mgr.getBetsOfUserAndCom(user_id="moi_en_uuid", com_id="ma_com_id_en_uuid")
        self.assertGreater(len(bets), 0)
        for u in bets:
            print(u)
        self.assertIsNotNone(bets)

        nb = mgr.delete(bet)
        self.assertEqual(1, nb)
Ejemplo n.º 2
0
    def test_countPlayer(self):
        os.environ['OPENSHIFT_MONGODB_DB_URL']=u"mongodb://*****:*****@127.0.0.1:27017/euroxxxvi"
        mgr = BetsManager()
        self.assertIsNotNone(mgr.getDb())
        bet = Bet()
        bet.resultA=1
        bet.resultB=10
        bet.user_id="moi_en_uuid"
        bet.com_id="ma_com_id_en_uuid"
        bet.category="categcode"
        bet.categoryName="categname"
        bet.key="keymatch"
        bet.libteamA="theliba"
        bet.libteamB="thelibb"
        bet.teamA="theteamA"
        bet.teamB="theteamb"
        bet.dateDeadLineBet=datetime(2016, 6, 2, 18, 15, 0, 0, tzinfo=timezone.utc)
        bet.dateMatch=datetime(2016, 6, 2, 18, 15, 0, 0, tzinfo=timezone.utc)

        mgr.createOrUpdate(bet)

        result = mgr.countPlayers("ma_com_id_en_uuid")
        self.assertEqual(1, result)
        players = mgr.players("ma_com_id_en_uuid")
        self.assertEqual(1, len(players))

        bet2 = Bet()
        bet2.resultA=1
        bet2.resultB=10
        bet2.user_id="moi_en_uuid"
        bet2.com_id="ma_com_id_en_uuid"
        bet2.category="categcode"
        bet2.categoryName="categname"
        bet2.key="keymatch"
        bet2.libteamA="theliba"
        bet2.libteamB="thelibb"
        bet2.teamA="theteamA"
        bet2.teamB="theteamb"
        bet2.dateDeadLineBet=datetime(2016, 6, 2, 18, 15, 0, 0, tzinfo=timezone.utc)
        bet2.dateMatch=datetime(2016, 6, 2, 18, 15, 0, 0, tzinfo=timezone.utc)
        mgr.createOrUpdate(bet)

        mgr.delete(bet)
        mgr.delete(bet2)
Ejemplo n.º 3
0
    def test_createOrUpdate(self):
        os.environ[
            'OPENSHIFT_MONGODB_DB_URL'] = u"mongodb://*****:*****@127.0.0.1:27017/euroxxxvi"
        mgr = BetsManager()
        self.assertIsNotNone(mgr.getDb())
        bet = Bet()
        bet.resultA = 1
        bet.resultB = 10
        bet.user_id = "moi_en_uuid"
        bet.com_id = "ma_com_id_en_uuid"
        bet.category = "categcode"
        bet.categoryName = "categname"
        bet.key = "keymatch"
        bet.libteamA = "theliba"
        bet.libteamB = "thelibb"
        bet.teamA = "theteamA"
        bet.teamB = "theteamb"
        bet.dateDeadLineBet = datetime(2016,
                                       6,
                                       2,
                                       18,
                                       15,
                                       0,
                                       0,
                                       tzinfo=timezone.utc)
        bet.dateMatch = datetime(2016, 6, 2, 18, 15, 0, 0, tzinfo=timezone.utc)

        mgr.createOrUpdate(bet)

        bets = mgr.getBetsOfUserAndCom(user_id="moi_en_uuid",
                                       com_id="ma_com_id_en_uuid")
        self.assertGreater(len(bets), 0)
        for u in bets:
            print(u)
        self.assertIsNotNone(bets)

        nb = mgr.delete(bet)
        self.assertEqual(1, nb)
Ejemplo n.º 4
0
    def test_countPlayer(self):
        os.environ[
            'OPENSHIFT_MONGODB_DB_URL'] = u"mongodb://*****:*****@127.0.0.1:27017/euroxxxvi"
        mgr = BetsManager()
        self.assertIsNotNone(mgr.getDb())
        bet = Bet()
        bet.resultA = 1
        bet.resultB = 10
        bet.user_id = "moi_en_uuid"
        bet.com_id = "ma_com_id_en_uuid"
        bet.category = "categcode"
        bet.categoryName = "categname"
        bet.key = "keymatch"
        bet.libteamA = "theliba"
        bet.libteamB = "thelibb"
        bet.teamA = "theteamA"
        bet.teamB = "theteamb"
        bet.dateDeadLineBet = datetime(2016,
                                       6,
                                       2,
                                       18,
                                       15,
                                       0,
                                       0,
                                       tzinfo=timezone.utc)
        bet.dateMatch = datetime(2016, 6, 2, 18, 15, 0, 0, tzinfo=timezone.utc)

        mgr.createOrUpdate(bet)

        result = mgr.countPlayers("ma_com_id_en_uuid")
        self.assertEqual(1, result)
        players = mgr.players("ma_com_id_en_uuid")
        self.assertEqual(1, len(players))

        bet2 = Bet()
        bet2.resultA = 1
        bet2.resultB = 10
        bet2.user_id = "moi_en_uuid"
        bet2.com_id = "ma_com_id_en_uuid"
        bet2.category = "categcode"
        bet2.categoryName = "categname"
        bet2.key = "keymatch"
        bet2.libteamA = "theliba"
        bet2.libteamB = "thelibb"
        bet2.teamA = "theteamA"
        bet2.teamB = "theteamb"
        bet2.dateDeadLineBet = datetime(2016,
                                        6,
                                        2,
                                        18,
                                        15,
                                        0,
                                        0,
                                        tzinfo=timezone.utc)
        bet2.dateMatch = datetime(2016,
                                  6,
                                  2,
                                  18,
                                  15,
                                  0,
                                  0,
                                  tzinfo=timezone.utc)
        mgr.createOrUpdate(bet)

        mgr.delete(bet)
        mgr.delete(bet2)