Beispiel #1
0
    def test_cache_clears_at_batch_exit(self):
        with BatchController.batch(self.USER_1):
            cache_1 = BatchController.get_cache(self.USER_1)

        cache_2 = BatchController.get_cache(self.USER_1)

        self.assertIsNot(cache_1, cache_2)
Beispiel #2
0
    def test_cache_clears_at_batch_exit(self):
        with BatchController.batch(self.USER_1):
            cache_1 = BatchController.get_cache(self.USER_1)

        cache_2 = BatchController.get_cache(self.USER_1)

        self.assertIsNot(cache_1, cache_2)
Beispiel #3
0
    def test_caches_are_independent_for_different_users(self):
        with BatchController.batch(self.USER_1):
            cache_1 = BatchController.get_cache(self.USER_1)

            with BatchController.batch(self.USER_2):
                cache_2 = BatchController.get_cache(self.USER_2)

        self.assertIsNot(cache_1, cache_2)
Beispiel #4
0
    def test_caches_are_independent_for_different_users(self):
        with BatchController.batch(self.USER_1):
            cache_1 = BatchController.get_cache(self.USER_1)

            with BatchController.batch(self.USER_2):
                cache_2 = BatchController.get_cache(self.USER_2)

        self.assertIsNot(cache_1, cache_2)
Beispiel #5
0
    def test_caches_identical_within_nestings(self):
        with BatchController.batch(self.USER_1):
            cache_1 = BatchController.get_cache(self.USER_1)

            with BatchController.batch(self.USER_2):
                cache_2 = BatchController.get_cache(self.USER_1)

            cache_3 = BatchController.get_cache(self.USER_1)

        self.assertIs(cache_1, cache_2)
        self.assertIs(cache_2, cache_3)
Beispiel #6
0
    def test_caches_identical_within_nestings(self):
        with BatchController.batch(self.USER_1):
            cache_1 = BatchController.get_cache(self.USER_1)

            with BatchController.batch(self.USER_2):
                cache_2 = BatchController.get_cache(self.USER_1)

            cache_3 = BatchController.get_cache(self.USER_1)

        self.assertIs(cache_1, cache_2)
        self.assertIs(cache_2, cache_3)
Beispiel #7
0
    def test_new_caches_for_new_batches(self):
        with BatchController.batch(self.USER_1):
            cache_1 = BatchController.get_cache(self.USER_1)

        with BatchController.batch(self.USER_1):
            cache_2 = BatchController.get_cache(self.USER_1)

            with BatchController.batch(self.USER_1):
                cache_3 = BatchController.get_cache(self.USER_1)

        self.assertIs(cache_2, cache_3)
        self.assertIsNot(cache_1, cache_2)
Beispiel #8
0
    def test_new_caches_for_new_batches(self):
        with BatchController.batch(self.USER_1):
            cache_1 = BatchController.get_cache(self.USER_1)

        with BatchController.batch(self.USER_1):
            cache_2 = BatchController.get_cache(self.USER_1)

            with BatchController.batch(self.USER_1):
                cache_3 = BatchController.get_cache(self.USER_1)

        self.assertIs(cache_2, cache_3)
        self.assertIsNot(cache_1, cache_2)
Beispiel #9
0
    def test_no_caches_outside_of_batches(self):
        cache_1 = BatchController.get_cache(self.USER_1)
        cache_2 = BatchController.get_cache(self.USER_2)

        # Identity testing is important here
        self.assertIsNot(cache_1, cache_2)
Beispiel #10
0
    def test_no_caches_outside_of_batches(self):
        cache_1 = BatchController.get_cache(self.USER_1)
        cache_2 = BatchController.get_cache(self.USER_2)

        # Identity testing is important here
        self.assertIsNot(cache_1, cache_2)