File: test_uuid.py

package info (click to toggle)
python-flask-seeder 1.2.0-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 292 kB
  • sloc: python: 1,062; makefile: 2
file content (22 lines) | stat: -rw-r--r-- 535 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import uuid

from unittest import TestCase
from unittest.mock import MagicMock, patch

from flask_seeder.generator import UUID


class TestUUIDGenerator(TestCase):
    def setUp(self):
        self.generator = UUID()

    @patch("uuid.uuid4", return_value=0)
    def test_generate_mock_uuid(self, m_uuid):
        result = self.generator.generate()

        assert result == 0

    def test_generate_uuid(self):
        result = self.generator.generate()
        
        self.assertEqual(4, uuid.UUID(str(result), version=4).version)