-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest_config_chunk_size.py
More file actions
54 lines (43 loc) · 1.75 KB
/
test_config_chunk_size.py
File metadata and controls
54 lines (43 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
"""
Tests for config.py specifically for the chunk_size parameter
"""
from config import get_env_vars
class TestChunkSize:
"""
Test cases for the chunk_size parameter in config.py
"""
def test_get_env_vars_with_default_chunk_size(self, monkeypatch):
"""
Test that chunk_size is set to default (100) when not specified
"""
monkeypatch.setenv("REPOSITORY", "owner/repo")
monkeypatch.setenv("GH_TOKEN", "token")
env_vars = get_env_vars(test=True)
assert env_vars.chunk_size == 100
def test_get_env_vars_with_custom_chunk_size(self, monkeypatch):
"""
Test that chunk_size is set to the custom value when specified
"""
monkeypatch.setenv("REPOSITORY", "owner/repo")
monkeypatch.setenv("GH_TOKEN", "token")
monkeypatch.setenv("CHUNK_SIZE", "200")
env_vars = get_env_vars(test=True)
assert env_vars.chunk_size == 200
def test_get_env_vars_with_small_chunk_size(self, monkeypatch):
"""
Test that chunk_size is set to minimum 10 when specified value is too small
"""
monkeypatch.setenv("REPOSITORY", "owner/repo")
monkeypatch.setenv("GH_TOKEN", "token")
monkeypatch.setenv("CHUNK_SIZE", "5")
env_vars = get_env_vars(test=True)
assert env_vars.chunk_size == 10
def test_get_env_vars_with_invalid_chunk_size(self, monkeypatch):
"""
Test that chunk_size is set to default (100) when an invalid value is specified
"""
monkeypatch.setenv("REPOSITORY", "owner/repo")
monkeypatch.setenv("GH_TOKEN", "token")
monkeypatch.setenv("CHUNK_SIZE", "not_a_number")
env_vars = get_env_vars(test=True)
assert env_vars.chunk_size == 100