public void SetUp() { bitbucketClient = Substitute.For <IBitbucketClient>(); mapper = Substitute.For <IMapper>(); accountByTeamNameQuery = new AccountByTeamNameQuery(bitbucketClient, mapper); }
public async Task LoginAsync(GitCredentials gitCredentials) { if (IsConnected) { return; } if (string.IsNullOrEmpty(gitCredentials.Login) || string.IsNullOrEmpty(gitCredentials.Password)) { throw new Exception("Credentials fields cannot be empty"); } _bitbucketClient = await CreateBitbucketClient(gitCredentials); var connectionData = new ConnectionData() { IsLoggedIn = true, UserName = _bitbucketClient.ApiConnection.Credentials.Login, Password = gitCredentials.Password, Host = gitCredentials.Host, IsEnterprise = gitCredentials.IsEnterprise }; OnConnectionChanged(connectionData); }
public void SetUp() { bitbucketClient = Substitute.For <IBitbucketClient>(); mapper = Substitute.For <IMapper>(); repositoriesByAccountNameQuery = new RepositoriesByAccountNameQuery(bitbucketClient, mapper); }
public PullRequestService(IBitbucketClient bitbucketClient, ICrucibleClient crucibleClient, IFishEyeClient fishEyeClient, IOptions <IntegrationsConfig> integrations, IOptions <SettingsConfig> settings) { this.bitbucketClient = bitbucketClient; this.crucibleClient = crucibleClient; this.fishEyeClient = fishEyeClient; this.integrations = integrations.Value; this.settings = settings.Value; }
public BitbucketTests(ITestOutputHelper testOutputHelper) { LogSettings.RegisterDefaultLogger <XUnitLogger>(LogLevels.Verbose, testOutputHelper); _bitbucketClient = BitbucketClient.Create(new Uri(BitbucketTestUri)); if (!string.IsNullOrEmpty(_username) && !string.IsNullOrEmpty(_password)) { _bitbucketClient.SetBasicAuthentication(_username, _password); } }
public virtual void Setup() { var bitbucketData = File.ReadAllText(TEST_FILE_PATH) .Split(Environment.NewLine.ToCharArray()) .Where(line => string.IsNullOrWhiteSpace(line) == false) .ToArray(); var apiKey = bitbucketData[0]; var apiSecretKey = bitbucketData[1]; var token = bitbucketData[2]; var tokenSecret = bitbucketData[3]; _defaultUser = bitbucketData[4]; _defaultRepository = bitbucketData[5]; _defaultCommit = bitbucketData[6]; _defaultTeam = bitbucketData[7]; var authClient = new BitbucketAuthenticationClient(apiKey, apiSecretKey); _mainClient = authClient.AuthentificateWithAccessToken(token, tokenSecret); }
public async Task LoginAsync(GitCredentials gitCredentials) { if (IsConnected) { return; } OnConnectionChanged(new ConnectionData() { IsLoggingIn = true }); if (string.IsNullOrEmpty(gitCredentials.Login) || string.IsNullOrEmpty(gitCredentials.Password)) { throw new Exception("Credentials fields cannot be empty"); } ConnectionData connectionData = ConnectionData.NotLogged; try { connectionData = new ConnectionData() { Password = gitCredentials.Password, Host = gitCredentials.Host, IsEnterprise = gitCredentials.IsEnterprise, IsLoggingIn = false }; Client = await CreateBitbucketClient(gitCredentials); connectionData.UserName = Client.ApiConnection.Credentials.Login; connectionData.Id = Client.ApiConnection.Credentials.AccountId; connectionData.IsLoggedIn = true; } finally { OnConnectionChanged(connectionData); } }
public void Logout() { _bitbucketClient = null; OnConnectionChanged(ConnectionData.NotLogged); }
public AccountByTeamNameQuery(IBitbucketClient bitbucketClient, IMapper mapper) { this.bitbucketClient = bitbucketClient; this.mapper = mapper; }
public async Task ChangeUserAsync(GitCredentials credentials) { Client = null; await LoginAsync(credentials); }
public BitbucketPullRequestWriter(NureOptions p_NureOptions, IBitbucketClient p_BitbucketClient) { m_NureOptions = p_NureOptions; m_BitbucketClient = p_BitbucketClient; }
public RepositoriesByAccountNameQuery(IBitbucketClient bitbucketClient, IMapper mapper) { this.bitbucketClient = bitbucketClient; this.mapper = mapper; }