(t *testing.T)
| 13 | ) |
| 14 | |
| 15 | func TestMigration(t *testing.T) { |
| 16 | cfg := config.ReadFromString(` |
| 17 | hosts: |
| 18 | github.com: |
| 19 | user: user1 |
| 20 | oauth_token: xxxxxxxxxxxxxxxxxxxx |
| 21 | git_protocol: ssh |
| 22 | enterprise.com: |
| 23 | user: user2 |
| 24 | oauth_token: yyyyyyyyyyyyyyyyyyyy |
| 25 | git_protocol: https |
| 26 | `) |
| 27 | |
| 28 | var m migration.MultiAccount |
| 29 | require.NoError(t, m.Do(cfg)) |
| 30 | |
| 31 | // First we'll check that the oauth tokens have been moved to their new locations |
| 32 | requireKeyWithValue(t, cfg, []string{"hosts", "github.com", "users", "user1", "oauth_token"}, "xxxxxxxxxxxxxxxxxxxx") |
| 33 | requireKeyWithValue(t, cfg, []string{"hosts", "enterprise.com", "users", "user2", "oauth_token"}, "yyyyyyyyyyyyyyyyyyyy") |
| 34 | |
| 35 | // Then we'll check that the old data has been left alone |
| 36 | requireKeyWithValue(t, cfg, []string{"hosts", "github.com", "user"}, "user1") |
| 37 | requireKeyWithValue(t, cfg, []string{"hosts", "github.com", "oauth_token"}, "xxxxxxxxxxxxxxxxxxxx") |
| 38 | requireKeyWithValue(t, cfg, []string{"hosts", "github.com", "git_protocol"}, "ssh") |
| 39 | |
| 40 | requireKeyWithValue(t, cfg, []string{"hosts", "enterprise.com", "user"}, "user2") |
| 41 | requireKeyWithValue(t, cfg, []string{"hosts", "enterprise.com", "oauth_token"}, "yyyyyyyyyyyyyyyyyyyy") |
| 42 | requireKeyWithValue(t, cfg, []string{"hosts", "enterprise.com", "git_protocol"}, "https") |
| 43 | } |
| 44 | |
| 45 | func TestMigrationSecureStorage(t *testing.T) { |
| 46 | cfg := config.ReadFromString(` |
nothing calls this directly
no test coverage detected