Exemple #1
0
 def testWithoutEncryptedVolumes(self):
     gui = main.tkinter.GuiClientLogin(
         'https://%s.%s' %
         (main.base_settings.SUBDOMAIN, main.base_settings.DOMAIN))
     main.corestorage.GetStateAndVolumeIds().AndReturn(
         (None, [], ['mock_volume_id']))
     gui.PlainVolumePrompt(False)
     self.mox.ReplayAll()
     main.main()
     self.mox.VerifyAll()
Exemple #2
0
    def testWithEncryptedVolumes(self, get_state_mock, gui_oauth_mock):
        opts = mock.Mock()
        opts.login_type = 'oauth2'
        opts.oauth2_client_id = 'stub_id'
        opts.oauth2_client_secret = 'stub_secret'
        opts.server_url = 'https://cvest.appspot.com'
        opts.username = '******'

        main.main(opts)

        get_state_mock.assert_called_once()

        gui_oauth_mock.assert_called_once_with('https://cvest.appspot.com',
                                               'user')
        gui_oauth_mock.return_value.EncryptedVolumePrompt.assert_called_once()
Exemple #3
0
    def testWithEncryptedVolumes(self):
        self.mox.StubOutClassWithMocks(main.tkinter, 'GuiOauth')
        gui = main.tkinter.GuiOauth('https://cvest.appspot.com')
        gui.EncryptedVolumePrompt()

        self.mox.StubOutWithMock(main.corestorage, 'GetStateAndVolumeIds')
        main.corestorage.GetStateAndVolumeIds().AndReturn(
            (None, ['mock_volume_id'], []))

        opts = mox.MockAnything()
        opts.login_type = 'oauth2'
        opts.oauth2_client_id = 'stub_id'
        opts.oauth2_client_secret = 'stub_secret'
        opts.server_url = 'https://cvest.appspot.com'

        self.mox.ReplayAll()
        main.main(opts)
        self.mox.VerifyAll()
  def testWithEncryptedVolumes(self):
    self.mox.StubOutClassWithMocks(main.tkinter, 'GuiOauth')
    gui = main.tkinter.GuiOauth('https://cvest.appspot.com')
    gui.EncryptedVolumePrompt()

    self.mox.StubOutWithMock(main.corestorage, 'GetStateAndVolumeIds')
    main.corestorage.GetStateAndVolumeIds().AndReturn((
        None, ['mock_volume_id'], []))

    opts = mox.MockAnything()
    opts.login_type = 'oauth2'
    opts.oauth2_client_id = 'stub_id'
    opts.oauth2_client_secret = 'stub_secret'
    opts.server_url = 'https://cvest.appspot.com'

    self.mox.ReplayAll()
    main.main(opts)
    self.mox.VerifyAll()