예제 #1
0
 def test_get_rpc_secret_returns_None_when_empty_file(self):
     maas_dir = os.path.join(self.environ['SNAP_DATA'], 'var', 'lib',
                             'maas')
     os.makedirs(maas_dir)
     secret_path = os.path.join(maas_dir, 'secret')
     open(secret_path, 'w').close()
     self.assertIsNone(snappy.get_rpc_secret())
예제 #2
0
 def test_set_rpc_secret_sets_secret(self):
     maas_dir = os.path.join(self.environ['SNAP_DATA'], 'var', 'lib',
                             'maas')
     os.makedirs(maas_dir)
     secret = factory.make_string()
     snappy.set_rpc_secret(secret)
     self.assertEquals(secret, snappy.get_rpc_secret())
예제 #3
0
 def test_set_rpc_secret_sets_secret(self):
     maas_dir = os.path.join(self.environ["SNAP_DATA"], "var", "lib",
                             "maas")
     os.makedirs(maas_dir)
     secret = factory.make_string()
     snappy.set_rpc_secret(secret)
     self.assertEquals(secret, snappy.get_rpc_secret())
예제 #4
0
 def test_get_rpc_secret_returns_None_when_empty_file(self):
     maas_dir = os.path.join(self.environ["SNAP_DATA"], "var", "lib",
                             "maas")
     os.makedirs(maas_dir)
     secret_path = os.path.join(maas_dir, "secret")
     open(secret_path, "w").close()
     self.assertIsNone(snappy.get_rpc_secret())
예제 #5
0
 def test_get_rpc_secret_returns_secret(self):
     maas_dir = os.path.join(self.environ['SNAP_DATA'], 'var', 'lib',
                             'maas')
     os.makedirs(maas_dir)
     secret_path = os.path.join(maas_dir, 'secret')
     secret = factory.make_string()
     with open(secret_path, 'w') as stream:
         stream.write(secret)
     self.assertEqual(secret, snappy.get_rpc_secret())
예제 #6
0
 def test_get_rpc_secret_returns_secret(self):
     maas_dir = os.path.join(self.environ["SNAP_DATA"], "var", "lib",
                             "maas")
     os.makedirs(maas_dir)
     secret_path = os.path.join(maas_dir, "secret")
     secret = factory.make_string()
     with open(secret_path, "w") as stream:
         stream.write(secret)
     self.assertEqual(secret, snappy.get_rpc_secret())
예제 #7
0
 def test_get_rpc_secret_returns_None_when_no_file(self):
     maas_dir = os.path.join(self.environ['SNAP_DATA'], 'var', 'lib',
                             'maas')
     os.makedirs(maas_dir)
     self.assertIsNone(snappy.get_rpc_secret())
예제 #8
0
 def test_set_rpc_secret_clears_secret(self):
     secret = factory.make_string()
     snappy.set_rpc_secret(secret)
     snappy.set_rpc_secret(None)
     self.assertIsNone(snappy.get_rpc_secret())
     self.assertFalse(self.secret_file.exists())
예제 #9
0
 def test_set_rpc_secret_sets_secret(self):
     secret = factory.make_string()
     snappy.set_rpc_secret(secret)
     self.assertEqual(secret, snappy.get_rpc_secret())
예제 #10
0
 def test_get_rpc_secret_returns_None_when_empty_file(self):
     self.secret_file.write_text("")
     self.assertIsNone(snappy.get_rpc_secret())
예제 #11
0
 def test_get_rpc_secret_returns_None_when_no_file(self):
     self.assertIsNone(snappy.get_rpc_secret())
예제 #12
0
 def test_get_rpc_secret_returns_secret(self):
     secret = factory.make_string()
     self.secret_file.write_text(secret)
     self.assertEqual(snappy.get_rpc_secret(), secret)
예제 #13
0
 def test_get_rpc_secret_returns_None_when_no_file(self):
     maas_dir = os.path.join(self.environ["SNAP_DATA"], "var", "lib",
                             "maas")
     os.makedirs(maas_dir)
     self.assertIsNone(snappy.get_rpc_secret())