Example #1
0
def test_random_string():
    random.seed(0)  # set seed for reproducible tests

    res = utils.random_string(8)
    assertEqual(len(res), 8)

    # Python 2 and Python 3 use different strategies for generation of
    # PRNG, according to the documentation available at
    # https://docs.python.org/3.4/library/random.html#random.seed
    if six.PY2:
        assertEqual(res, '0UAqFzWs')
    else:
        assertEqual(res, '2yW4Acq9')
Example #2
0
def test_random_string():
    random.seed(0)  # set seed for reproducible tests

    res = utils.random_string(8)
    assert len(res) == 8

    # Python 2 and Python 3 use different strategies for generation of
    # PRNG, according to the documentation available at
    # https://docs.python.org/3.4/library/random.html#random.seed
    if six.PY2:
        assert res == "0UAqFzWs"
    else:
        assert res == "2yW4Acq9"
Example #3
0
    def test_random_string(self):
        random.seed(0)  # set seed for reproducible tests

        res = utils.random_string(8)
        self.assertEqual(len(res), 8)

        # Python 2 and Python 3 use different strategies for generation of
        # PRNG, according to the documentation available at
        # https://docs.python.org/3.4/library/random.html#random.seed
        if six.PY2:
            self.assertEqual(res, '0UAqFzWs')
        else:
            self.assertEqual(res, '2yW4Acq9')