Ejemplo n.º 1
0
	def test_save_unmodified(self):
		with self.mocked_config():
			settings = octoprint.settings.Settings()
			last_modified = settings.last_modified

			settings.save()
			self.assertEqual(settings.last_modified, last_modified)

			settings.save(force=True)
			self.assertGreater(settings.last_modified, last_modified)
Ejemplo n.º 2
0
    def test_save_unmodified(self):
        with self.settings() as settings:
            last_modified = settings.last_modified

            # sleep a bit to make sure we do have a change in the timestamp
            time.sleep(1.0)

            settings.save()
            self.assertEqual(settings.last_modified, last_modified)

            settings.save(force=True)
            self.assertGreater(settings.last_modified, last_modified)
Ejemplo n.º 3
0
    def test_save_unmodified(self):
        with self.mocked_config():
            settings = octoprint.settings.Settings()
            last_modified = settings.last_modified

            # sleep a bit to make sure we do have a change in the timestamp
            time.sleep(1.0)

            settings.save()
            self.assertEqual(settings.last_modified, last_modified)

            settings.save(force=True)
            self.assertGreater(settings.last_modified, last_modified)
Ejemplo n.º 4
0
	def test_save_unmodified(self):
		with self.mocked_config():
			settings = octoprint.settings.Settings()
			last_modified = settings.last_modified

			# sleep a bit to make sure we do have a change in the timestamp
			time.sleep(1.0)

			settings.save()
			self.assertEqual(settings.last_modified, last_modified)

			settings.save(force=True)
			self.assertGreater(settings.last_modified, last_modified)
Ejemplo n.º 5
0
	def test_save(self):
		with self.mocked_config() as paths:
			basedir, config_path = paths
			settings = octoprint.settings.Settings()

			# current modification date of config.yaml
			current_modified = os.stat(config_path).st_mtime

			# set a new value
			settings.set(["api", "key"], "newkey")

			# should not be written automatically
			self.assertEqual(current_modified, os.stat(config_path).st_mtime)

			# should be updated after calling save though
			settings.save()
			self.assertNotEqual(current_modified, os.stat(config_path).st_mtime)
Ejemplo n.º 6
0
    def test_save(self):
        with self.settings() as settings:
            config_path = settings._configfile

            # current modification date of config.yaml
            current_modified = os.stat(config_path).st_mtime

            # sleep a bit to make sure we do have a change in the timestamp
            time.sleep(1.0)

            # set a new value
            settings.set(["api", "key"], "newkey")

            # should not be written automatically
            self.assertEqual(current_modified, os.stat(config_path).st_mtime)

            # should be updated after calling save though
            settings.save()
            self.assertNotEqual(current_modified, os.stat(config_path).st_mtime)