12
12
@pytest .fixture
13
13
def sample_config (tmpdir ):
14
14
codebase_flags = CodebaseFeatureFlags (debug = True , verify_graph = False )
15
- return SessionConfig ( file_path = f" { tmpdir } /test_config.toml" , repository = RepositoryConfig (full_name = "test-org" , repo_name = "test-repo" ), feature_flags = FeatureFlagsConfig (codebase = codebase_flags ))
15
+ return Config ( repository = RepositoryConfig (full_name = "test-org/test-repo " , repo_name = "test-repo" ), feature_flags = FeatureFlagsConfig (codebase = codebase_flags ))
16
16
17
17
18
18
def test_config_initialization (tmpdir ):
@@ -22,9 +22,9 @@ def test_config_initialization(tmpdir):
22
22
assert config .secrets is not None
23
23
24
24
25
- def test_config_with_values (tmpdir ):
26
- config = SessionConfig ( file_path = f" { tmpdir } /test_config.toml" , repository = {"full_name" : "test-org" , "repo_name" : "test-repo" })
27
- assert config .repository .full_name == "test-org"
25
+ def test_config_with_values ():
26
+ config = Config ( repository = {"full_name" : "test-org/test-repo " , "repo_name" : "test-repo" })
27
+ assert config .repository .full_name == "test-org/test-repo "
28
28
assert config .repository .repo_name == "test-repo"
29
29
30
30
@@ -39,12 +39,12 @@ def test_save_config(mock_mkdir, mock_file, sample_config):
39
39
# Verify the content being written
40
40
written_data = mock_file ().write .call_args [0 ][0 ]
41
41
parsed_data = toml .loads (written_data )
42
- assert parsed_data ["repository" ]["full_name" ] == "test-org"
42
+ assert parsed_data ["repository" ]["full_name" ] == "test-org/test-repo "
43
43
44
44
45
45
def test_get_config_value (sample_config ):
46
46
# Test getting a simple value
47
- assert json .loads (sample_config .get ("repository.full_name" )) == "test-org"
47
+ assert json .loads (sample_config .get ("repository.full_name" )) == "test-org/test-repo "
48
48
49
49
# Test getting a nested value
50
50
assert json .loads (sample_config .get ("feature_flags.codebase.debug" )) is True
@@ -57,8 +57,8 @@ def test_set_config_value(sample_config):
57
57
# Instead of mocking save, we'll mock the open function used within save
58
58
with patch ("builtins.open" , new_callable = mock_open ) as mock_file :
59
59
# Test setting a simple string value
60
- sample_config .set ("repository.full_name" , "new-org" )
61
- assert sample_config .repository .full_name == "new-org"
60
+ sample_config .set ("repository.full_name" , "new-org/test-repo " )
61
+ assert sample_config .repository .full_name == "new-org/test-repo "
62
62
63
63
# Test setting a boolean value
64
64
sample_config .set ("feature_flags.codebase.debug" , "false" )
@@ -83,7 +83,7 @@ def test_config_str_representation(sample_config):
83
83
assert isinstance (config_str , str )
84
84
# Verify it's valid JSON
85
85
parsed = json .loads (config_str )
86
- assert parsed ["repository" ]["full_name" ] == "test-org"
86
+ assert parsed ["repository" ]["full_name" ] == "test-org/test-repo "
87
87
88
88
89
89
def test_set_config_new_override_key (sample_config ):
0 commit comments