Example #1
0
    def test_set_get_changenumber(self, mocker):
        """Test setting and retrieving changenumber."""
        uwsgi = get_uwsgi(True)
        storage = UWSGISplitStorage(uwsgi)

        assert storage.get_change_number() == None
        storage.set_change_number(123)
        assert storage.get_change_number() == 123
Example #2
0
    def test_kill_locally(self):
        """Test kill local."""
        uwsgi = get_uwsgi(True)
        storage = UWSGISplitStorage(uwsgi)

        split = Split('some_split', 123456789, False, 'some', 'traffic_type',
                      'ACTIVE', 1)
        storage.put(split)
        storage.set_change_number(1)

        storage.kill_locally('test', 'default_treatment', 2)
        assert storage.get('test') is None

        storage.kill_locally('some_split', 'default_treatment', 0)
        assert storage.get('some_split').change_number == 1
        assert storage.get('some_split').killed is False
        assert storage.get('some_split').default_treatment == 'some'

        storage.kill_locally('some_split', 'default_treatment', 3)
        assert storage.get('some_split').change_number == 3