def test_no_path_given_directory_does_not_exist(self):
        path = tempfile.mkdtemp()
        os.rmdir(path)
        devappserver2._generate_storage_paths("example.com_myapp").AndReturn([path])

        self.mox.ReplayAll()
        self.assertEqual(path, devappserver2._get_storage_path(None, "dev~example.com:myapp"))
        self.mox.VerifyAll()
        self.assertTrue(os.path.isdir(path))
Exemplo n.º 2
0
    def test_no_path_given_directory_does_not_exist(self):
        path = tempfile.mkdtemp()
        os.rmdir(path)
        devappserver2._generate_storage_paths('example.com_myapp').AndReturn(
            [path])

        self.mox.ReplayAll()
        self.assertEqual(
            path, devappserver2._get_storage_path(None, 'example.com:myapp'))
        self.mox.VerifyAll()
        self.assertTrue(os.path.isdir(path))
Exemplo n.º 3
0
  def test_no_path_given_directory_exists(self):
    path1 = tempfile.mkdtemp()
    os.chmod(path1, 0777)
    path2 = tempfile.mkdtemp()  # Made with mode 0700.

    devappserver2._generate_storage_paths('myapp').AndReturn([path1, path2])

    self.mox.ReplayAll()
    self.assertEqual(
        path2,
        devappserver2._get_storage_path(None, 'myapp'))
    self.mox.VerifyAll()
    def test_no_path_given_directory_exists(self):
        path1 = tempfile.mkdtemp()
        os.chmod(path1, 0777)
        path2 = tempfile.mkdtemp()  # Made with mode 0700.

        devappserver2._generate_storage_paths("example.com_myapp").AndReturn([path1, path2])

        self.mox.ReplayAll()
        if sys.platform == "win32":
            expected_path = path1
        else:
            expected_path = path2
        self.assertEqual(expected_path, devappserver2._get_storage_path(None, "dev~example.com:myapp"))
        self.mox.VerifyAll()
    def test_no_path_given_directory_exists(self):
        path1 = tempfile.mkdtemp()
        os.chmod(path1, 0o777)
        path2 = tempfile.mkdtemp()  # Made with mode 0700.

        devappserver2._generate_storage_paths('example.com_myapp').AndReturn(
            [path1, path2])

        self.mox.ReplayAll()
        if sys.platform == 'win32':
            expected_path = path1
        else:
            expected_path = path2
        self.assertEqual(
            expected_path,
            devappserver2._get_storage_path(None, 'dev~example.com:myapp'))
        self.mox.VerifyAll()
Exemplo n.º 6
0
  def test_windows(self):
    tempfile.gettempdir().AndReturn('/tmp')

    self.mox.ReplayAll()
    self.assertEqual(
        [os.path.join('/tmp', 'appengine.myapp'),
         os.path.join('/tmp', 'appengine.myapp.1'),
         os.path.join('/tmp', 'appengine.myapp.2')],
        list(itertools.islice(devappserver2._generate_storage_paths('myapp'),
                              3)))
    self.mox.VerifyAll()
  def test_windows(self):
    tempfile.gettempdir().AndReturn('/tmp')

    self.mox.ReplayAll()
    self.assertEqual(
        [os.path.join('/tmp', 'appengine.myapp'),
         os.path.join('/tmp', 'appengine.myapp.1'),
         os.path.join('/tmp', 'appengine.myapp.2')],
        list(itertools.islice(devappserver2._generate_storage_paths('myapp'),
                              3)))
    self.mox.VerifyAll()
Exemplo n.º 8
0
  def test_broken_getuser(self):
    getpass.getuser().AndRaise(Exception())
    tempfile.gettempdir().AndReturn('/tmp')

    self.mox.ReplayAll()
    self.assertEqual(
        [os.path.join('/tmp', 'appengine.myapp'),
         os.path.join('/tmp', 'appengine.myapp.1'),
         os.path.join('/tmp', 'appengine.myapp.2')],
        list(itertools.islice(devappserver2._generate_storage_paths('myapp'),
                              3)))
    self.mox.VerifyAll()
  def test_broken_getuser(self):
    getpass.getuser().AndRaise(Exception())
    tempfile.gettempdir().AndReturn('/tmp')

    self.mox.ReplayAll()
    self.assertEqual(
        [os.path.join('/tmp', 'appengine.myapp'),
         os.path.join('/tmp', 'appengine.myapp.1'),
         os.path.join('/tmp', 'appengine.myapp.2')],
        list(itertools.islice(devappserver2._generate_storage_paths('myapp'),
                              3)))
    self.mox.VerifyAll()
Exemplo n.º 10
0
    def test_windows(self):
        tempfile.gettempdir().AndReturn("/tmp")

        self.mox.ReplayAll()
        self.assertEqual(
            [
                os.path.join("/tmp", "appengine.myapp"),
                os.path.join("/tmp", "appengine.myapp.1"),
                os.path.join("/tmp", "appengine.myapp.2"),
            ],
            list(itertools.islice(devappserver2._generate_storage_paths("myapp"), 3)),
        )
        self.mox.VerifyAll()