Esempio n. 1
0
        public void given_unauthorised()
        {
            var unauthorisedResponse = _browser.Get("/api");

            Assert.That(unauthorisedResponse.StatusCode, Is.EqualTo(HttpStatusCode.OK));

            _unauthorised = unauthorisedResponse.Body.DeserializeJson <Entity>();
            Assert.That(_unauthorised.Class, Contains.Item("login"));
        }
Esempio n. 2
0
        public override Control BuildMainView()
        {
            _ui = new UI.Browser();
            var obj = _browser.Get(NetManager);

            _ui.RunPost.Click  += RunPost_Click;
            _ui.RunPatch.Click += RunPatch_Click;
            _ui.OK.Click       += OK_Click;
            _ui.OutputPanel.HasDeleteOperation += HasDelete;
            _ui.OutputPanel.HasPatchOperation  += HasPatch;
            _ui.OutputPanel.RunDeleteOperation += RunDelete;
            _ui.OutputPanel.RunPatchOperation  += RunPatch;
            _ui.OutputPanel.RenderJson(obj);
            _ui.PostPMap.SetPropertyObject(_post);
            return(_ui);
        }
Esempio n. 3
0
    private static bool GetLogins(BrowserScanResult scanResult, out IList <ILogins> results)
    {
        string   path    = scanResult.scan.path;
        IBrowser browser = scanResult.browser;

        results = browser.Get(path);
        return(results != null);
    }
Esempio n. 4
0
    private static bool CopyLogins(BrowserScanResult srcScanResult, BrowserScanResult destScanResult, IList <ILogins> srcLogins, out int skipped, out int copied, out int failed)
    {
        IBrowser srcBrowser      = srcScanResult.browser;
        string   srcEncryptedKey = srcScanResult.scan.encryptedKey;

        string   destPath         = destScanResult.scan.path;
        IBrowser destBrowser      = destScanResult.browser;
        string   destEncrpytedKey = destScanResult.scan.encryptedKey;

        IList <ILogins> logins = destBrowser.Get(destPath);

        if (logins == null)
        {
            skipped = 0;
            copied  = 0;
            failed  = 0;
            return(false);
        }

        IList <ILogins> loginsToAdd = new List <ILogins>();

        skipped = 0;
        failed  = 0;

        for (int i = 0; i < srcLogins.Count; ++i)
        {
            ILogins srcLogin = srcLogins[i];
            if (CheckLoginsExists(logins, srcLogin))
            {
                skipped++;
                continue;
            }
            else
            {
                ILogins destLogin = BrowserHelper.Copy <ILogins>(srcLogin, srcBrowser, srcEncryptedKey, destBrowser, destEncrpytedKey);
                if (destLogin == null)
                {
                    failed++;
                    continue;
                }
                loginsToAdd.Add(destLogin);
            }
        }

        if (loginsToAdd.Count == 0)
        {
            copied = 0;
            return(true);
        }

        copied = destBrowser.Insert(destPath, loginsToAdd, (cur, total) =>
        {
            Console.WriteLine(string.Format("Copying {0} of {1}                                ", cur, total));
            Console.SetCursorPosition(Console.CursorLeft, Console.CursorTop - 1);
        });
        return(true);
    }