コード例 #1
0
    def test_create_missing_connections__minimum_connections(self):
        logic.create_missing_connections()

        for person in storage.persons_storage.filter(
                state=relations.PERSON_STATE.IN_GAME):
            self.assertTrue(
                len(
                    storage.social_connections.get_connected_persons_ids(
                        person)) >= conf.settings.SOCIAL_CONNECTIONS_MINIMUM)
コード例 #2
0
ファイル: test_logic.py プロジェクト: Alkalit/the-tale
    def test_create_missing_connections__restore_connections(self):
        logic.create_missing_connections()

        out_gamed_person = random.choice(storage.persons_storage.filter(state=relations.PERSON_STATE.IN_GAME))

        out_gamed_person.move_out_game()
        logic.out_game_obsolete_connections()

        logic.create_missing_connections()

        for person in storage.persons_storage.filter(state=relations.PERSON_STATE.IN_GAME):
            self.assertTrue(len(storage.social_connections.get_connected_persons_ids(person)) >= conf.settings.SOCIAL_CONNECTIONS_MINIMUM)
コード例 #3
0
ファイル: test_logic.py プロジェクト: Alkalit/the-tale
    def test_out_game_obsolete_connections(self):
        logic.create_missing_connections()

        out_gamed_person = random.choice(storage.persons_storage.filter(state=relations.PERSON_STATE.IN_GAME))

        out_gamed_connections_number = len(storage.social_connections.get_connected_persons_ids(out_gamed_person))

        with self.check_delta(lambda: len(storage.social_connections.all()), -out_gamed_connections_number):
            out_gamed_person.move_out_game()
            logic.out_game_obsolete_connections()

        self.assertEqual(models.SocialConnection.objects.filter(state=relations.SOCIAL_CONNECTION_STATE.OUT_GAME).count(),
                         out_gamed_connections_number)
コード例 #4
0
    def test_create_missing_connections__restore_connections(self):
        logic.create_missing_connections()

        out_gamed_person = random.choice(
            storage.persons_storage.filter(
                state=relations.PERSON_STATE.IN_GAME))

        out_gamed_person.move_out_game()
        logic.out_game_obsolete_connections()

        logic.create_missing_connections()

        for person in storage.persons_storage.filter(
                state=relations.PERSON_STATE.IN_GAME):
            self.assertTrue(
                len(
                    storage.social_connections.get_connected_persons_ids(
                        person)) >= conf.settings.SOCIAL_CONNECTIONS_MINIMUM)
コード例 #5
0
    def test_out_game_obsolete_connections(self):
        logic.create_missing_connections()

        out_gamed_person = random.choice(
            storage.persons_storage.filter(
                state=relations.PERSON_STATE.IN_GAME))

        out_gamed_connections_number = len(
            storage.social_connections.get_connected_persons_ids(
                out_gamed_person))

        with self.check_delta(lambda: len(storage.social_connections.all()),
                              -out_gamed_connections_number):
            out_gamed_person.move_out_game()
            logic.out_game_obsolete_connections()

        self.assertEqual(
            models.SocialConnection.objects.filter(
                state=relations.SOCIAL_CONNECTION_STATE.OUT_GAME).count(),
            out_gamed_connections_number)
コード例 #6
0
ファイル: test_logic.py プロジェクト: Alkalit/the-tale
    def test_create_missing_connections__minimum_connections(self):
        logic.create_missing_connections()

        for person in storage.persons_storage.filter(state=relations.PERSON_STATE.IN_GAME):
            self.assertTrue(len(storage.social_connections.get_connected_persons_ids(person)) >= conf.settings.SOCIAL_CONNECTIONS_MINIMUM)
コード例 #7
0
ファイル: test_logic.py プロジェクト: Alkalit/the-tale
 def test_create_missing_connections__success(self):
     with self.check_increased(models.SocialConnection.objects.count):
         with self.check_changed(lambda: storage.social_connections._version):
             logic.create_missing_connections()
コード例 #8
0
    def test_create_missing_connections__minimum_connections(self):
        logic.create_missing_connections()

        for person in storage.persons.all():
            self.assertTrue(len(storage.social_connections.get_connected_persons_ids(person)) >= conf.settings.SOCIAL_CONNECTIONS_MINIMUM)
コード例 #9
0
 def test_create_missing_connections__success(self):
     with self.check_increased(models.SocialConnection.objects.count):
         with self.check_changed(lambda: storage.social_connections._version):
             logic.create_missing_connections()